Skip to content

Features¤

Mkdocs Plugins¤

  • Blacklist: Prevents sensitive content showing up in (public) docs
  • Find Pages: Adds pages to your nav tree, even when not configured in mkdocs.yml
  • Literate Programming: Emacs-org babel inspired dynamic evaluation of fenced code blocks
  • Markdown Replace: Replaces markdown before rendering to html. Including or excluding replacements within fenced blocks
  • Page Tree: Inserts a breadcrumb into your footer
  • Stats: Prints a lot of stats about the build process, ready for piping into jq

Framework¤

It made sense to bundle all the plugins within one repo, since it offers a few generic features, for any mkdocs plugin.

Note

You still have to enable the plugins you really want, within your mkdocs.yml file.

The others just waste a little bit of disk space on the build machine but do neither impact performance nor size of your builds.

Tech

The plugins inherit not directly from mkdocs.plugins.BasePlugin but from the intermediate lcdoc.mkdocs.tools.MDPlugin. This allows their hooks to be wrapped within a metrics and logs framework, applicable to all of them.

  • If you want to use the framework for your own plugins, you can inherit from MDPlugin as well.

You gain from

  • an app class, providing the log methods and a die method, accepting **kw args (see structlog), configured during hook run time for the current hook and, when applicable, current page.

  • In the stats plugin you can configure, at which log levels you want to have build breaks

  • the plugin and the page have a stats dict attribute, in which you can collect metrics. Some metrics like run time are collected for you.

See the Stats plugin for more on this.

Back to top