# import stat for mkdocs
参考 https://shd101wyy.github.io/markdown-preview-enhanced/#/zh-cn/file-imports
## 使用
### install
```sh
pip install mkdocs-import-stat-plugin
```
### use
```yml
plugins:
- import-stat
```
## 支持的import 语法有:
- `as`
@import "hello.xxx" {as="go"}
- `line_begin` 和 `line_end`
@import "hello.xxx" {line_begin=1, line_end=3}
## 拓展语法
一下测试均在 `material` 主题中测试
- `tab` 用于对整个代码块缩进,这样更好地与 material 的 tabs 兼容
```txt
@import "hello.xxx" {tab}
```
- 也可直接缩进使用,但markdown-preview-enhanced 插件在vscode中就会有渲染问题
```txt
@import "hello.xxx"
```
- `p_dir` 用于指定上级路径
eg:
```sh
.
├── docs
│ ├── code
│ │ └── test.html
│ ├── test_dir
│ │ └── test.md
```
test.md
```md
# test
@import "../code/test.html"
```
mkdocs 插件获取当前路径只会获取到 docs 层,最终导致找不到文件
所以可以使用以下方式解决
```md
# test
@import "../code/test.html" {p_dir="test_dir"}
```
## 清空flag
如直接用
````txt
```js {cmd a=x c=x e}
console.log('mkdocs')
```
````
后 mkdocs 渲染会出错,该插件会将其 {cmd a=x c=x e} 删除,这样就与markdown-preview-enhanced 插件不冲突了
## License
[MIT](https://github.com/q9090960bnb3/import-stat-mkdocs-plugin/blob/main/LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/q9090960bnb3/mkdocs-import-stat-plugin.git",
"name": "mkdocs-import-stat-plugin",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "mkdocs, markdown, import",
"author": "q9090960bnb3",
"author_email": "q9090960bnb3@163.com",
"download_url": "https://files.pythonhosted.org/packages/27/56/2bf79790123713c7089c576d5d95f63addc312087281d5131c8722848cb1/mkdocs_import_stat_plugin-1.0.3.tar.gz",
"platform": null,
"description": "# import stat for mkdocs\n\n\u53c2\u8003 https://shd101wyy.github.io/markdown-preview-enhanced/#/zh-cn/file-imports\n\n## \u4f7f\u7528\n\n### install\n\n```sh\npip install mkdocs-import-stat-plugin\n```\n\n### use\n\n```yml\nplugins:\n - import-stat\n```\n\n## \u652f\u6301\u7684import \u8bed\u6cd5\u6709\uff1a\n\n- `as`\n \n@import \"hello.xxx\" {as=\"go\"}\n\n- `line_begin` \u548c `line_end`\n\n@import \"hello.xxx\" {line_begin=1, line_end=3}\n\n## \u62d3\u5c55\u8bed\u6cd5\n\n\u4e00\u4e0b\u6d4b\u8bd5\u5747\u5728 `material` \u4e3b\u9898\u4e2d\u6d4b\u8bd5\n\n- `tab` \u7528\u4e8e\u5bf9\u6574\u4e2a\u4ee3\u7801\u5757\u7f29\u8fdb\uff0c\u8fd9\u6837\u66f4\u597d\u5730\u4e0e material \u7684 tabs \u517c\u5bb9\n\n```txt\n@import \"hello.xxx\" {tab}\n```\n\n - \u4e5f\u53ef\u76f4\u63a5\u7f29\u8fdb\u4f7f\u7528\uff0c\u4f46markdown-preview-enhanced \u63d2\u4ef6\u5728vscode\u4e2d\u5c31\u4f1a\u6709\u6e32\u67d3\u95ee\u9898\n\n```txt\n @import \"hello.xxx\" \n```\n\n- `p_dir` \u7528\u4e8e\u6307\u5b9a\u4e0a\u7ea7\u8def\u5f84\n\neg:\n\n```sh\n.\n\u251c\u2500\u2500 docs\n\u2502 \u251c\u2500\u2500 code\n\u2502 \u2502 \u2514\u2500\u2500 test.html\n\u2502 \u251c\u2500\u2500 test_dir\n\u2502 \u2502 \u2514\u2500\u2500 test.md\n```\n\ntest.md\n\n```md\n# test\n\n@import \"../code/test.html\"\n```\n\nmkdocs \u63d2\u4ef6\u83b7\u53d6\u5f53\u524d\u8def\u5f84\u53ea\u4f1a\u83b7\u53d6\u5230 docs \u5c42\uff0c\u6700\u7ec8\u5bfc\u81f4\u627e\u4e0d\u5230\u6587\u4ef6\n\n\u6240\u4ee5\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u5f0f\u89e3\u51b3\n\n```md\n# test\n\n@import \"../code/test.html\" {p_dir=\"test_dir\"}\n```\n\n## \u6e05\u7a7aflag\n\n\u5982\u76f4\u63a5\u7528\n\n````txt\n```js {cmd a=x c=x e}\nconsole.log('mkdocs')\n```\n````\n\n\u540e mkdocs \u6e32\u67d3\u4f1a\u51fa\u9519\uff0c\u8be5\u63d2\u4ef6\u4f1a\u5c06\u5176 {cmd a=x c=x e} \u5220\u9664\uff0c\u8fd9\u6837\u5c31\u4e0emarkdown-preview-enhanced \u63d2\u4ef6\u4e0d\u51b2\u7a81\u4e86\n\n## License\n\n[MIT](https://github.com/q9090960bnb3/import-stat-mkdocs-plugin/blob/main/LICENSE)",
"bugtrack_url": null,
"license": "MIT",
"summary": "import stat plugin for mkdocs like Markdown Preview Enhanced import",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://github.com/q9090960bnb3/mkdocs-import-stat-plugin.git",
"Repository": "https://github.com/q9090960bnb3/mkdocs-import-stat-plugin.git"
},
"split_keywords": [
"mkdocs",
" markdown",
" import"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ebf6d7481ea14a2e78b3ee7b21f8ce2d5bd55a27abb1195d534e8cca3aaff8cc",
"md5": "7819e5de27144f96992f57356085510d",
"sha256": "21ed02a59f8370fc2484c63f3c6c9a69956e7be48d71c382b3dc72afc725dbd3"
},
"downloads": -1,
"filename": "mkdocs_import_stat_plugin-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7819e5de27144f96992f57356085510d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 5585,
"upload_time": "2024-09-29T09:28:43",
"upload_time_iso_8601": "2024-09-29T09:28:43.950860Z",
"url": "https://files.pythonhosted.org/packages/eb/f6/d7481ea14a2e78b3ee7b21f8ce2d5bd55a27abb1195d534e8cca3aaff8cc/mkdocs_import_stat_plugin-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "27562bf79790123713c7089c576d5d95f63addc312087281d5131c8722848cb1",
"md5": "c1c52ccb3c3ab270d0d4239ba66b10f1",
"sha256": "bee1748c068e533d061dc6b0b91ecb55cd8ca30a2b5cfb02be10740de8117db1"
},
"downloads": -1,
"filename": "mkdocs_import_stat_plugin-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "c1c52ccb3c3ab270d0d4239ba66b10f1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 4173,
"upload_time": "2024-09-29T09:28:45",
"upload_time_iso_8601": "2024-09-29T09:28:45.738842Z",
"url": "https://files.pythonhosted.org/packages/27/56/2bf79790123713c7089c576d5d95f63addc312087281d5131c8722848cb1/mkdocs_import_stat_plugin-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-29 09:28:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "q9090960bnb3",
"github_project": "mkdocs-import-stat-plugin",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mkdocs-import-stat-plugin"
}