Mkdocs Macros Plugin

screenshot of Mkdocs Macros Plugin
mkdocs

Create richer and more beautiful pages in MkDocs, by using variables and calls to macros in the markdown code.

Overview:

Mkdocs-Macros is a plugin for MkDocs that enhances the functionality by allowing users to utilize variables and macros for automation tasks, resulting in more visually appealing pages. This plugin makes it easier for contributors to create rich and beautiful content by transforming markdown pages into jinja2 templates.

Features:

  • Variables and Macros: Automate tasks and create dynamic content using variables and macros.
  • Jinja2 Templates: Transform markdown pages into jinja2 templates for customization.
  • Custom Filters: Define custom filters to further enhance the content.
  • Wide Range of Facilities: Utilize Jinja2 features like conditions and loops for more advanced content manipulation.
  • Predefined Variables: Access predefined objects for environment, project, page, and git information.

Standard Installation:

  1. Download the package.
  2. Run the installation command:
    pip install mkdocs-macros-plugin
    

Manual Installation:

For development or testing purposes, install additional dependencies:

pip install -r requirements-dev.txt

Declaration of Plugin:

Declare the plugin in the mkdocs.yml file:

plugins:
  - search
  - macros

Configuration for Undefined Variables:

To have a page fail on undefined variables, add the following configuration:

extra:
  macros_fail_on_undefined: true

For more configuration options, refer to the plugin documentation.

Summary:

Mkdocs-Macros is a powerful plugin for MkDocs that allows users to enhance their content creation process by utilizing variables and macros. By transforming markdown pages into jinja2 templates, users can create dynamic and visually appealing content. With the ability to define custom filters and access predefined variables, this plugin opens up a wide range of possibilities for customization and automation.

mkdocs
MkDocs

MkDocs is a fast, simple and downright gorgeous static site generator that's geared towards building project documentation. Documentation source files are written in Markdown, and configured with a single YAML configuration file.

documentation
Documentation

Documentation themes are built specifically for writing technical and product documentation. They are normally written and maintained in Markdown. The often include a navigation menu, search bar, clear headings, semantic document structure and clean typography.