Crates.io | mdbook-all-the-markdowns |
lib.rs | mdbook-all-the-markdowns |
version | 0.3.0 |
source | src |
created_at | 2021-11-01 22:06:41.429717 |
updated_at | 2021-11-10 22:10:09.653265 |
description | Render all markdown files in a given folder structure |
homepage | https://github.com/bombsimon/mdbook-all-the-markdowns |
repository | https://github.com/bombsimon/mdbook-all-the-markdowns |
max_upload_size | |
id | 475451 |
size | 304,114 |
This is a mdbook
preprocessor that will walk a specified base path and add all
the markdowns to your mdbook
. This is pretty naive and will probably work best
for smaller projects but feel free to give it a go for any folder structure!
The preprocessor can be configured with the following settings:
[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 = []
Since section
is a list of tables you can add multiple groups by adding
multiple sections.
[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 = []
Given the following folder structure:
.
├── 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
Based on the title in each document, combined with the folder names as title case, the preprocessor with the first configuration would render the following:
Result with the first example with one section. | Result with the second example with multiple sections. |
You can test rendering any of the example folders in this directory with the
book found in examples/book1
with mdbook serve examples/book1
.