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

abs_path

指示是否为绝对路径

# test
以下会搜索 系统下的 `/data/test.md` 文件
@import "/data/test.md" {abs_path} 

以下会搜索 当前项目目录下的 `docs/data/test.md` 文件
@import "/data/test.md"

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.4.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_import_stat_plugin-1.0.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mkdocs_import_stat_plugin-1.0.4.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.8.10 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for mkdocs_import_stat_plugin-1.0.4.tar.gz
Algorithm Hash digest
SHA256 e3ccfc023bb49c0bc801c90aac64c7c0d99d133ac795cfc39606c7d6979770c8
MD5 b45f50b8da26d1e1e4f88d0ad49898b7
BLAKE2b-256 5bdac5e7ccec1d462c1760ee9b383f416adf43dcc6860d3f7bd54c017d972ab6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkdocs_import_stat_plugin-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 50440368b328e29ccb3675230df2124e568ec38724b25186761c510efcef9861
MD5 a54fde2014c6e59262201d07ade59248
BLAKE2b-256 4927487b0c788d8fcfbe2baf0ffcb2921d315996c9e96b19bac710af7f2900be

See more details on using hashes here.

Supported by

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