import stat for mkdocs
参考 https://shd101wyy.github.io/markdown-preview-enhanced/#/zh-cn/file-imports
使用
install
pip install mkdocs-import-stat-plugin
use
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 兼容
@import "hello.xxx" {tab}
- 也可直接缩进使用,但markdown-preview-enhanced 插件在vscode中就会有渲染问题
@import "hello.xxx"
p_dir用于指定上级路径
eg:
.
├── docs
│ ├── code
│ │ └── test.html
│ ├── test_dir
│ │ └── test.md
test.md
# test
@import "../code/test.html"
mkdocs 插件获取当前路径只会获取到 docs 层,最终导致找不到文件
所以可以使用以下方式解决
# test
@import "../code/test.html" {p_dir="test_dir"}
清空flag
如直接用
```js {cmd a=x c=x e}
console.log('mkdocs')
```
后 mkdocs 渲染会出错,该插件会将其 {cmd a=x c=x e} 删除,这样就与markdown-preview-enhanced 插件不冲突了
abs_path
指示是否为绝对路径
# test
以下会搜索 系统下的 `/data/test.md` 文件
@import "/data/test.md" {abs_path}
以下会搜索 当前项目目录下的 `docs/data/test.md` 文件
@import "/data/test.md"
License
Metadata
Release files for mkdocs-import-stat-plugin 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mkdocs_import_stat_plugin-1.0.5.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mkdocs_import_stat_plugin-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.8 kB
Release files / mkdocs_import_stat_plugin-1.0.5.tar.gz
| Download URL | mkdocs_import_stat_plugin-1.0.5.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de882929122e5ebea7f604b67f57f9371c01021909c3cc3a9599840ed98e7f64
|
|
BLAKE2b-256 checksum How to use checksums |
1d774b8c168318ea6dec4748f47fdaad600c4f7a711bd36cb57f307bb0ea3a43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.8.10 Linux/5.15.167.4-microsoft-standard-WSL2
|
Release files / mkdocs_import_stat_plugin-1.0.5-py3-none-any.whl
| Download URL | mkdocs_import_stat_plugin-1.0.5-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84dfb74fe0b1e46e1ca74b1fe9e27c732238277d8d70efd3ca29176090c130ce
|
|
BLAKE2b-256 checksum How to use checksums |
89d57816b3d674d1bf8f3a496c8c929e71826702b616aff69a1483a250d2fdb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.8.10 Linux/5.15.167.4-microsoft-standard-WSL2
|