Crates.io | md-tangle |
lib.rs | md-tangle |
version | 0.1.4 |
source | src |
created_at | 2018-10-02 03:13:40.838245 |
updated_at | 2018-10-05 18:19:38.809616 |
description | A command line tool to tangle code blocks in markdown file to source code file. |
homepage | |
repository | https://github.com/parsing-tech/md-rs |
max_upload_size | |
id | 87505 |
size | 4,564 |
A command line tool to tangle code blocks in markdown file to source code file.
To build the program, nightly rust toolchain is needed.
rustup
is the tool to help programmers install rust toolchains.
Then do:
rustup install nightly
cargo +nightly install md-tangle
USAGE:
md-tangle [FLAGS] [PATH]...
FLAGS:
-r, --recursive recursively traverse <DIR>
-h, --help Prints help information
-V, --version Prints version information
ARGS:
<PATH>... <PATH> can be <FILE> or <DIR>
ignore non unicode <PATH>
ignore non `.md` files
ignore `.md` files without tangle property
In file engine.md
---
tangle: lib.rs
---
lib.rs
``` rust
fn tangle (string: &str) -> Result {
let mut result = String::new ();
let mut lines = string.lines ();
while let Some (line) = lines.next () {
if block_begin_line_p (line) {
tangle_collect (&mut result, &mut lines)?;
}
}
Ok (result)
}
```
engine.md
is tangled to lib.rs