Zensical¶
Experimental
Zensical doesn't run MkDocs plugins: websites it builds are exported by a command run once they are built. The command reads what Zensical writes (built pages, search index), which may change while Zensical is in beta.
Installation¶
Install the command and the browser it prints documents with, next to Zensical:
pip install mkdocs-exporter
playwright install --with-deps --only-shell chromium
It also installs MkDocs, whose configuration options the command uses: it doesn't interfere with Zensical.
Usage¶
Build the website, then export it from the directory of its configuration file:
zensical build
mkdocs-exporter build
The documents are written into the built website, next to its pages (e.g. site/guide/index.pdf), and books where their output says.
See Command line for its options (e.g. --strict).
Configuration¶
The options are the plugin's, read from the configuration of the website, which Zensical ignores:
[project.plugins.exporter.formats.pdf]
stylesheets = ["resources/stylesheets/pdf.css"]
[project.plugins.exporter.formats.pdf.covers]
front = "resources/templates/covers/front.html.j2"
[[project.plugins.exporter.formats.pdf.books]]
output = "documentation.pdf"
plugins:
- exporter:
formats:
pdf:
stylesheets:
- resources/stylesheets/pdf.css
covers:
front: resources/templates/covers/front.html.j2
books:
- output: documentation.pdf
Pages are exported like with MkDocs:
- Their options come from the front matter of their source file, with the defaults of
.meta.ymlfiles when themetaplugin is enabled. - Books follow
nav; without it, the navigation of the built pages. Pages outside of the navigation get a document, but aren't part of books. - Pages without a source file, generated by plugins (e.g. blog archives, tag indexes), don't get a document.
- Cover templates receive
page(page.title,page.url,page.meta),config(the settings of the website),extraand the keys of the front matter. - What is meant for documents only (the
mkdocs-exporter-onlyclass) is then removed from the pages of the website, and elements are teleported (data-mkdocs-exporter-teleport). Build the website again before exporting it again: the command refuses pages it already changed.
Differences with the plugin¶
- Buttons (
buttons,exporter.buttonsof pages) aren't added to the pages of the website. - Websites being served aren't exported.
- Cover templates don't get MkDocs' objects (e.g.
page.toc,navigation), nor the variables of the macros plugin. - Websites built by MkDocs or ProperDocs are refused: list the plugin in
plugins, it exports documents while they are built.