A document-code sync tools for document engineering. Writing 是一个自动 “文档-代码” 同步工具。解析 Markdown 中的代码定义,读取目标代码,并嵌入到新的文档中。
Language parse support by guarding with tree-sitter, current supported language: Java, JavaScript, Rust
install with Rust Cargo
cargo install writing
or download from: release
usage:
writing -p README.md
all command:
OPTIONS:
-h, --help Print help information
-i, --input <INPUT> [default: README.md]
-o, --output <OUTPUT> [default: out.md]
-V, --version Print version information
by Lines
// doc-code: file("src/lib.rs").line()[1, 5]
by Section
// doc-section: file("src/lib.rs").section("section1")
by Function
// doc-func: file("src/lib.rs").func()["pre_process_file", "process_file"]
```graphviz?
Graphviz
```
setup:
git clone https://github.com/inherd/writing
cargo build
others: parser with pest
process:
- read markdown file
- filter by line with ends_with
// doc-***
- parse
// doc-**
from[writing.pest](src/parser/writing.pest)
- read code
- generate output
see in writing.pest
@ 2021 This code is distributed under the MIT license. See LICENSE
in this directory.