Markdown Macros
Author: BarCar · Repository: github.com/barcar/markdown-macros
A Python-Markdown extension that brings MkDocs Macros–style Jinja2 templating to any Markdown pipeline: variables (config + YAML front matter), macros, and filters. Works with Zensical, MkDocs, or plain Python—without the MkDocs plugin.
Features
- Variables from config, YAML front matter, or
include_yaml - Macros and filters via
define_env(env)in a Python module (same API as MkDocs Macros) - YAML front matter parsed and exposed as
md.Meta/md.front_matter
Installation
pip install markdown-macros-extension
Requires: markdown>=3.4, pyyaml>=6.0, jinja2>=3.0.
Quick example
import markdown
from markdown_macros import MacrosExtension
text = """---
title: My Page
---
# {{ title }}
The answer is {{ 6 * 7 }}.
"""
md = markdown.Markdown(extensions=[MacrosExtension()])
html = md.convert(text) # title and 42 rendered
In Zensical or MkDocs, add markdown_macros to your Markdown extensions and optionally set module_name, variables, include_yaml, etc. See the documentation for configuration, usage, and the full API.
Compatibility: API-aligned with the MkDocs Macros plugin (variables, macros, filters, define_env); see Compatibility in the docs.
Documentation
Online: Documentation (GitHub Pages).
To build the docs locally:
pip install -e ".[docs]"
zensical serve
License
MIT License. See LICENSE.
Metadata
Release files for markdown-macros-extension 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| markdown_macros_extension-0.5.0.tar.gz | 16.8 kB | Without provenance | Details for markdown_macros_extension-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| markdown_macros_extension-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for markdown_macros_extension-0.5.0-py3-none-any.whl |
Total release size: 28.8 kB
Release files / markdown_macros_extension-0.5.0.tar.gz
| Download URL | markdown_macros_extension-0.5.0.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
89bbf4ca992429b303bf3507dda8293d3b622ed073f399a3ced00d88873dd2bd
|
|
BLAKE2b-256 checksum How to use checksums |
e6a79a30569bc2f29a2bedf4244124363cf94f731620a0d9371fadb0c88ac24c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / markdown_macros_extension-0.5.0-py3-none-any.whl
| Download URL | markdown_macros_extension-0.5.0-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5d2afd20dbda668cfd7b20470ff1a474ebe874760fa9447e35e297955996d66
|
|
BLAKE2b-256 checksum How to use checksums |
76078df1042546b1f8e295f8f1f662e3042469afa902532b0033c7fd55b62ece
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for markdown-macros-extension 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.