Skip to main content

mdformat-zola

PyPI Supported Python versions check OpenSSF Scorecard OpenSSF Best Practices

Mdformat plugin for Zola-flavored Markdown. It formats Zola content files while keeping shortcodes, heading anchors, and code-block annotations intact.

See the changelog for released changes and contributing guide for fragment rules.

Plain mdformat mangles Zola content. It reflows shortcode bodies (a Mermaid diagram becomes one escaped line), escapes the * in {{/* … */}}, and wraps long inline shortcodes mid-call. This plugin adds Zola's syntax to mdformat so those constructs round-trip.

Zola syntax

Each construct below gets one stable form. Where Zola treats ordering as insignificant, the plugin sorts.

Shortcodes

The plugin normalizes inline shortcodes {{ name(args) }} and their escaped form {{/* name(args) */}}: it collapses whitespace, sorts arguments by name, and settles on one quote style. It does not wrap or escape them.

Input:

{{  youtube( autoplay=true ,  id="dQw4w9WgXcQ" ) }}

Output:

{{ youtube(autoplay=true, id="dQw4w9WgXcQ") }}

Body shortcodes {% name(args) %} … {% end %} (and the escaped {%/* … */%}) get the same treatment on their opening tag. A raw body such as a Mermaid diagram stays byte-for-byte:

{% mermaid() %}
graph TD
  A["velodex[x]"] --> B[*]
{% end %}

The body of a prose shortcode is Markdown that Zola re-renders, so the plugin formats it. By default this applies to admonition, aside, callout, caution, details, important, note, quote, tip, and warning; every other shortcode keeps its body verbatim. Point the plugin at your own set with the markdown_shortcodes option, on the CLI or in .mdformat.toml:

mdformat --zola-markdown-shortcodes quote,note,sidebar content/
# .mdformat.toml
[plugin.zola]
markdown_shortcodes = ["quote", "note", "sidebar"]

Pass an empty value to keep every body verbatim.

Heading anchors

Zola lets you pin a heading's id and classes with a {#id .class} suffix. The plugin puts the id first, then the classes in alphabetical order:

## Introduction {.lead #intro}

Formats to:

## Introduction {#intro .lead}

Code-block annotations

The plugin reorders Zola's syntax-highlighting annotations to a fixed sequence (linenos, linenostart, hl_lines, hide_lines, name), normalizes their whitespace, and keeps unknown annotations:

```rust, hl_lines=3-4  8-9,linenos , linenostart=10

Formats to:

```rust,linenos,linenostart=10,hl_lines=3-4 8-9

Internal links such as [text](@/pages/about.md#anchor) survive as ordinary links, no special handling needed.

Bundled features

Installing the plugin pulls in the mdformat plugins that cover the rest of Zola's Markdown flavor (GitHub-Flavored Markdown with footnotes, definition lists, alerts, and TOML +++ frontmatter), plus code formatters for fenced blocks:

Markdown syntax:

Code-block formatting:

Usage

mdformat content/

Metadata

Release files for mdformat-zola 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mdformat-zola 1.0.3
File Size Uploaded Provenance Actions
mdformat_zola-1.0.3.tar.gz 57.5 kB With provenance Details for mdformat_zola-1.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mdformat-zola 1.0.3
File Interpreter ABI Platform Actions
mdformat_zola-1.0.3-py3-none-any.whl Python 3 none any Details for mdformat_zola-1.0.3-py3-none-any.whl

Total release size: 70.2 kB

Release files / mdformat_zola-1.0.3.tar.gz

Download URL mdformat_zola-1.0.3.tar.gz
Size 57.5 kB
Tags Source
SHA-256 checksum
How to use checksums
33fdb34b17e5e764308d8f3e31496659a9307e6f43aa9af2f986ffde2b335a0b
BLAKE2b-256 checksum
How to use checksums
6dc7d3446e188e95ad0af43695d3ddcd25e23fb5f1446cb72b25e7ae3d2af0cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / mdformat_zola-1.0.3-py3-none-any.whl

Download URL mdformat_zola-1.0.3-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb4fb1d5665559421070fbafcae20853052cf15c04de90030721dca6bbf90712
BLAKE2b-256 checksum
How to use checksums
cc04e2606d528fb2c382f600c8cf4ebc12befc8c4e8be06d1a48946c384921ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for mdformat-zola 1.0.3

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mdformat_zola-1.0.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page