Skip to content
/ writing Public

A document-code sync tools for document engineering. Writing 是一个自动 “文档-代码” 同步工具。解析 Markdown 中的代码定义,读取目标代码,并嵌入到新的文档中。

Notifications You must be signed in to change notification settings

feakin/writing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

  1. git clone https://github.com/inherd/writing
  2. cargo build

others: parser with pest

process:

  1. read markdown file
  2. filter by line with ends_with // doc-***
  3. parse // doc-** from [writing.pest](src/parser/writing.pest)
  4. read code
  5. generate output

Grammar

see in writing.pest

Documents

API 库的文档体系支持:主流编程语言的文档设计

文档工程体验设计:重塑开发者体验

License

@ 2021 This code is distributed under the MIT license. See LICENSE in this directory.

About

A document-code sync tools for document engineering. Writing 是一个自动 “文档-代码” 同步工具。解析 Markdown 中的代码定义,读取目标代码,并嵌入到新的文档中。

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages