Writing
A document-code sync tools for document engineering. Writing 是一个自动 “文档-代码” 同步工具。解析 Markdown 中的代码定义,读取目标代码,并嵌入到新的文档中。
Language parse support by guarding with tree-sitter, current supported language: Java, JavaScript, Rust
Usage
Install
install with Rust Cargo
cargo install writing
or download from: release
Run
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
Samples
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
```
Development
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
Grammar
see in writing.pest
Documents
License
@ 2021 This code is distributed under the MIT license. See LICENSE
in this directory.