{"id":31921858,"url":"https://github.com/rmw-lib/mdi","last_synced_at":"2025-10-13T22:55:13.253Z","repository":{"id":46747181,"uuid":"515658530","full_name":"rmw-lib/mdi","owner":"rmw-lib","description":"markdown include","archived":false,"fork":false,"pushed_at":"2023-02-17T09:14:50.000Z","size":49,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-01T15:44:13.811Z","etag":null,"topics":["include","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/rmw-lib.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-19T16:18:19.000Z","updated_at":"2023-02-10T15:08:39.000Z","dependencies_parsed_at":"2023-01-31T00:00:51.236Z","dependency_job_id":null,"html_url":"https://github.com/rmw-lib/mdi","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/rmw-lib/mdi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmw-lib%2Fmdi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmw-lib%2Fmdi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmw-lib%2Fmdi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmw-lib%2Fmdi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rmw-lib","download_url":"https://codeload.github.com/rmw-lib/mdi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmw-lib%2Fmdi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017087,"owners_count":26085984,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["include","markdown"],"created_at":"2025-10-13T22:55:06.747Z","updated_at":"2025-10-13T22:55:13.246Z","avatar_url":"https://github.com/rmw-lib.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- EDIT /Users/z/rmw/mdi/readme.md --\u003e\n\n# mdi\n\n\u003ca href=\"https://docs.rs/mdi\"\u003e\u003cimg src=\"https://img.shields.io/badge/RUST-API%20DOC-blue?style=for-the-badge\u0026logo=docs.rs\u0026labelColor=333\" alt=\"Api Doc\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/rmw-lib/mdi/releases\"\u003e\u003cimg src=\"https://img.shields.io/badge/Download-EXE-090?style=for-the-badge\u0026logo=rust\u0026labelColor=333\" alt=\"Download\"\u003e\u003c/a\u003e\n\n[English](#english-readme) | [中文说明](#中文说明)\n\n---\n\n## English Readme\n\nmarkdown include code / version / markdown ...\n\n### Preface\n\nEmbedding version numbers and demo code in `readme.md` is a very common requirement.\n\nThere are some similar tools on the market, but none of them works well. So I wrote one myself ( executable size 200 KB ).\n\nThe function is to write a statement like `‍\u003e ./demo.js` in markdown to embed the code, and the screenshot of the generated content is as follows :\n\n![](https://raw.githubusercontent.com/gcxfd/img/gh-pages/i9g9We.png)\n\nIn addition, with the [markdown translation tool](https://rmw.link/log/2021-12-09-markdown-translate) based on deepl , you can automatically translate and render Chinese and English in the same `readme.md` file.\n\nThen set an in-text anchor point (like this readme) at the top of the github readme, and click it to jump to the various language versions of the instructions, which will be a good user experience.\n\n### Install\n\n[Download from github](https://github.com/rmw-lib/mdi/releases) or `cargo install mdi`\n\n### Use\n\n\u003c!-- EDIT /Users/z/rmw/mdi/example.md --\u003e\n\n`mdi [dir]`\n\nWill search `xxx.mdi.md` in the directory , replace `\u003e ./xxx.rs` into embed code and output it to `xxx.md`.\n\nIf the embed is a markdown file, the references are rendered recursively.\n\nSee example [readme.mdi.md](https://raw.githubusercontent.com/rmw-lib/mdi/master/readme.mdi.md) , and the resulting file [readme.md](https://raw.githubusercontent.com/rmw-lib/mdi/master/readme.md)\n\nDemo for include code :\n\n  [→ demo.js](demo.js)\n\n  ```js\n  var a = 1;\n  console.log(a);\n  ```\n\n\nThe `~` in `\u003e ~/xxx.rs` indicates a file reference based on the project's root directory.\n\n`mdi` will look up the `.git` directory from the current directory (or the command line argument `[dir]`), using the first directory where the `.git` folder exists as the root of the project, or the current directory if it is not found.\n\nPaths ignored in `.gitignore` are ignored.\n\n### About\n\nThis project is part of **[rmw.link](//rmw.link)** Code Project\n\n![rmw.link logo](https://raw.githubusercontent.com/rmw-link/logo/master/rmw.red.bg.svg)\n\n---\n\n\u003c!-- EDIT /Users/z/rmw/mdi/zh.md --\u003e\n\n## 中文说明\n\nmarkdown 中嵌入代码 / 版本号 / markdown ...\n\n### 序言\n\n在 `readme.md` 中嵌入版本号、嵌入演示代码，是很常见的需求。\n\n市面上有一些类似工具，但都不好用。于是自己写了一个 ( 可执行文件大小 200 KB )。\n\n实现的功能是， markdown 中写类似 `‍\u003e ./demo.js` 的语句就会嵌入代码，生成内容效果截图如下 :\n\n![](https://raw.githubusercontent.com/gcxfd/img/gh-pages/i9g9We.png)\n\n另外，配合我写的 [基于 deepl 的 markdown 翻译工具](https://rmw.link/log/2021-12-09-markdown-translate)，就可以中英自动翻译并呈现在同一个 `readme.md` 文件中。\n\n再在 github readme 的顶部设置一个文内锚点（如本文），点击就可以跳转到各种语言版本的说明，用户体验会很好。\n\n### 安装\n\n[从 github 下载](https://github.com/rmw-lib/mdi/releases) 或者 `cargo install mdi`\n\n### 使用\n\n\u003c!-- EDIT /Users/z/rmw/mdi/example.md --\u003e\n\n`mdi [dir]`\n\n会搜索目录下的 `xxx.mdi.md` 把 `\u003e ./xxx.rs` 替换为代码内容嵌入 ，然后输出到 `xxx.md` 。\n\n如果嵌入的是一个 markdown 文件，会递归渲染其中的引用。\n\n`\u003e ~/xxx.rs` 中的 `~` 表示基于项目根目录的文件引用。\n\n`mdi` 会从当前目录 (或命令行参数`[dir]`) 开始向上查找 `.git` 目录，以首个存在 `.git` 文件夹的目录作为项目根目录，如果没找到，就以当前目录为根目录。\n\n会忽略 `.gitignore` 中忽略的路径。\n\n查看演示文件 [readme.mdi.md](https://raw.githubusercontent.com/rmw-lib/mdi/master/readme.mdi.md) ，以及生成的文件 [readme.md](https://raw.githubusercontent.com/rmw-lib/mdi/master/readme.md)\n\n嵌入代码演示 :\n\n  [→ demo.js](demo.js)\n\n  ```js\n  var a = 1;\n  console.log(a);\n  ```\n\n\n### 关于\n\n本项目隶属于 **人民网络 ([rmw.link](//rmw.link))** 代码计划。\n\n![人民网络海报](https://raw.githubusercontent.com/rmw-link/logo/master/rmw.red.bg.svg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmw-lib%2Fmdi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frmw-lib%2Fmdi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmw-lib%2Fmdi/lists"}