Skip to main content

A variables extension for Markdown

Project description



.. |variables-ci-badge| image::
:alt: Travis CI build status
:scale: 100%

A Markdown extension to add support for variables.

Licensed under the `ISC License`_.

.. _ISC License:


The mdx_variables plugin requires only the base `markdown`_ library.

.. _markdown:


Install with ``pip install mdx_variables``.


Allows inserting variables into Markdown.

The following Markdown example:

.. code:: markdown

This paragraph contains ${chickens} chickens.

This paragraph contains no chickens but ${foxes} foxes.

Are there ninjas here? ${ninjas}.

Might result in:

.. code:: markdown

This paragraph contains 5 chickens.

This paragraph contains no chickens but 3 foxes.

Are there ninjas here? ninjas not found.

Python usage:

.. code:: python

md = markdown.Markdown(
'variables': {
'vars': {
'chickens': '5',
'foxes': (lambda: 3),
'__getattr__': (lambda name: "{} not found".format(name)),

Configuration options:

* ``vars``: A dictionary mapping variable names to variable values.

If a value is a function, that function will be called without arguments and
the result will be used as the variable value.

The special variable ``__getattr__`` may specify a function
``f(name) -> value`` to call when no matching variable is found.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mdx-variables, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size mdx-variables-0.2.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page