Skip to content

πŸ—ƒοΈ Preprocessor for mdbook to render all the markdowns!

License

Notifications You must be signed in to change notification settings

bombsimon/mdbook-all-the-markdowns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

All the markdowns
All The Markdowns!

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!

Configuration

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
# If you want to allow more or other files than `README.md` to be treated as top
# level index files you can specify them in `index-filenames`.
index-filenames = ["README.md", "index.md"]

[[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 = []

Example

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.

Test

You can test rendering any of the example folders in this directory with the book found in examples/book1 with mdbook serve examples/book1.

About

πŸ—ƒοΈ Preprocessor for mdbook to render all the markdowns!

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages