{"id":13906322,"url":"https://github.com/feakin/writing","last_synced_at":"2025-07-18T04:30:52.740Z","repository":{"id":112895520,"uuid":"420081552","full_name":"feakin/writing","owner":"feakin","description":"A document-code sync tools for document engineering. Writing 是一个自动 “文档-代码” 同步工具。解析 Markdown 中的代码定义，读取目标代码，并嵌入到新的文档中。","archived":false,"fork":false,"pushed_at":"2021-10-25T11:32:22.000Z","size":68,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-07T23:47:35.118Z","etag":null,"topics":["documentation","documentation-generator","markdown"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/feakin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-10-22T11:59:21.000Z","updated_at":"2022-10-11T05:41:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"b2fd556d-1ac4-4da7-97e1-46d5c2e64210","html_url":"https://github.com/feakin/writing","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feakin%2Fwriting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feakin%2Fwriting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feakin%2Fwriting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feakin%2Fwriting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/feakin","download_url":"https://codeload.github.com/feakin/writing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226344604,"owners_count":17610173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["documentation","documentation-generator","markdown"],"created_at":"2024-08-06T23:01:33.533Z","updated_at":"2024-11-25T14:31:16.771Z","avatar_url":"https://github.com/feakin.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Writing \n\n\u003e  A document-code sync tools for document engineering. Writing 是一个自动 “文档-代码” 同步工具。解析 Markdown 中的代码定义，读取目标代码，并嵌入到新的文档中。\n\nLanguage parse support by [guarding](https://github.com/inherd/guarding) with [tree-sitter](https://github.com/tree-sitter/tree-sitter)， current supported language: Java, JavaScript, Rust\n\n## Usage\n\n### Install\n\ninstall with Rust Cargo \n\n```\ncargo install writing\n```\n\nor download from: [release](https://github.com/inherd/writing/releases)\n\n### Run\n\nusage:\n\n```\nwriting -p README.md\n```\n\nall command:\n\n```bash\nOPTIONS:\n    -h, --help               Print help information\n    -i, --input \u003cINPUT\u003e      [default: README.md]\n    -o, --output \u003cOUTPUT\u003e    [default: out.md]\n    -V, --version            Print version information\n```\n\n## Samples\n\nby Lines\n\n```writing\n// doc-code: file(\"src/lib.rs\").line()[1, 5]\n```\n\nby Section\n\n```writing\n// doc-section: file(\"src/lib.rs\").section(\"section1\")\n```\n\nby Function\n\n```writing\n// doc-func: file(\"src/lib.rs\").func()[\"pre_process_file\", \"process_file\"]\n```\n\n````custom image\n```graphviz?\nGraphviz\n```\n````\n\n## Development\n\nsetup:\n\n1. `git clone https://github.com/inherd/writing`\n2. `cargo build`\n\nothers: parser with [pest](https://github.com/pest-parser/pest)\n\nprocess:\n\n1. read markdown file\n2. filter by line with ends_with `// doc-***`\n3. parse `// doc-**` from `[writing.pest](src/parser/writing.pest)`\n4. read code\n5. generate output\n\n### Grammar\n\nsee in [writing.pest](src/parser/writing.pest)\n\n### Documents\n\n[API 库的文档体系支持：主流编程语言的文档设计](https://www.phodal.com/blog/api-ducumentation-design-dsl-base/)\n\n[文档工程体验设计：重塑开发者体验](https://www.phodal.com/blog/documentation-enginnering-experience-design/)\n\nLicense\n---\n\n@ 2021 This code is distributed under the MIT license. See `LICENSE` in this directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeakin%2Fwriting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffeakin%2Fwriting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeakin%2Fwriting/lists"}