Skip to main content

import stat plugin for mkdocs like Markdown Preview Enhanced import

Project description

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_beginline_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 插件不冲突了

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_import_stat_plugin-1.0.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file mkdocs_import_stat_plugin-1.0.3.tar.gz.

File metadata

  • Download URL: mkdocs_import_stat_plugin-1.0.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.15 Linux/5.15.146.1-microsoft-standard-WSL2

File hashes

Hashes for mkdocs_import_stat_plugin-1.0.3.tar.gz
Algorithm Hash digest
SHA256 bee1748c068e533d061dc6b0b91ecb55cd8ca30a2b5cfb02be10740de8117db1
MD5 c1c52ccb3c3ab270d0d4239ba66b10f1
BLAKE2b-256 27562bf79790123713c7089c576d5d95f63addc312087281d5131c8722848cb1

See more details on using hashes here.

File details

Details for the file mkdocs_import_stat_plugin-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_import_stat_plugin-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 21ed02a59f8370fc2484c63f3c6c9a69956e7be48d71c382b3dc72afc725dbd3
MD5 7819e5de27144f96992f57356085510d
BLAKE2b-256 ebf6d7481ea14a2e78b3ee7b21f8ce2d5bd55a27abb1195d534e8cca3aaff8cc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page