Reputation: 813
Just discovered mkdocs and really like it. I am currently porting online done in a proprietary tool into it.
The only stumbling block I've had is implementing auto-appending snippets.
I was able to implement abbreviations as described here:
https://squidfunk.github.io/mkdocs-material/reference/abbreviations/
My next step was to add a glossary as described on that page by moving those abbreviations into a snippets file as described on the same page.
But rather than having to manually add the snippets to every Markdown file in my project, I wanted to use auto-append as described here:
https://facelessuser.github.io/pymdown-extensions/extensions/snippets/
My mkdocs.yml file declares its theme and extensions as follows:
theme:
name: material
markdown_extensions:
- attr_list
- abbr
- pymdownx.snippets
But, I'm unclear on where I exactly configure "auto_append", "base_path" and the other options mentioned in that latter document. If anyone has a working example I'd appreciate it.
EDIT 18 Jan 2023: I can now get the auto_append working using the following configuration in mkdocs.yml:
theme:
name: material
markdown_extensions:
- pymdownx.snippets:
auto_append: ["abbreviations.md"]
# base_path: ["."]
base_path: ["docs"]
...where my file structure is as follows:
[docs]
abbreviations.md
{other topics.md}
[includes]
[site]
mkdocs.yml
However, as soon as I add - attr_list
and - abbr
to mkdocs.yml, auto append stops working:
theme:
name: material
markdown_extensions:
- attr_list
- abbr
- pymdownx.snippets
auto_append: ["abbreviations.md"]
# base_path: ["."] # for root of repo
base_path: ["docs"]
Upvotes: 0
Views: 2289
Reputation: 81
The snippet options are provided where you specify the markdown_extensions
in your mkdocs.yml
file, e.g.
# mkdocs.yml
...
markdown_extensions:
- pymdownx.snippets:
auto_append: ["../LICENSE"]
# base_path: ["."] # for root of repo
base_path: ["docs"]
Hopefully this helps!
Upvotes: 1