2 个不稳定版本
0.3.0 | 2021 年 11 月 10 日 |
---|---|
0.2.0 | 2021 年 11 月 1 日 |
#1547 在 文本处理
255KB
361 代码行
所有 Markdowns!
这是一个 mdbook
预处理器,它将遍历指定的基本路径并将所有 Markdown 添加到您的 mdbook
。这是一个相当简单的工具,可能最适合小型项目,但您也可以尝试用于任何目录结构!
配置
预处理器可以使用以下设置进行配置
[preprocessor.all-the-markdowns]
# This will mark all folders generated for a proper index as draft, making them
# non clickable. By default this is false and the content will just be the name
# of the folder as title.
draft-folders = true
[[preprocessor.all-the-markdowns.section]]
# The title to use in the index on the left. Can be useful if book also consist
# of static content or if creating multiple sections.
title = "Auto generated"
# The base directory to find markdowns in, this is usually the root of your
# project if you're only creating a single section.
base = "./examples/example-folder-structures/slim"
# Paths to ignore. No matter where you set your base you can always ignore given
# patterns. These needs to be relative to the base since the directory traverser
# will match if a file or director _starts with_ any of these patterns.
ignore = []
由于 section
是一个表格列表,您可以通过添加多个部分来添加多个组。
[preprocessor.all-the-markdowns]
[[preprocessor.all-the-markdowns.section]]
title = "Libraries"
base = "./examples/example-folder-structures/slim/my-libraries"
ignore = []
[[preprocessor.all-the-markdowns.section]]
title = "Services"
base = "./examples/example-folder-structures/slim/my-services"
ignore = []
示例
给定以下目录结构
.
├── my-libraries
│ └── lib-biz
│ ├── INSTALLATION.md
│ ├── README.md
│ ├── sub-lib-a
│ │ ├── CONTRIBUTORS.md
│ │ ├── README.md
│ │ └── USAGE.md
│ └── sub-lib-b
│ └── README.md
└── my-services
├── service-bar
│ ├── README.md
│ └── infra
│ └── kubernetes
│ └── README.md
└── service-foo
└── README.md
基于每个文档的标题,结合文件夹名称作为标题大写,具有第一种配置的预处理器将渲染以下内容
第一个示例的一个部分的结果。 | 第二个示例的多个部分的结果。 |
测试
您可以使用 mdbook serve examples/book1
在 examples/book1
中测试渲染此目录中的任何示例文件夹。
依赖项
~13–27MB
~352K SLoC