Skip to main content

mdformat-hugo

PyPI Supported Python versions check

Mdformat plugin for Hugo-flavored Markdown. Formats Hugo content files while preserving shortcodes and markdown attributes.

See the changelog for released changes. Pull requests with user-facing changes need a changelog.d/+short-name.<type>.md fragment. Use the skip news label for changes that do not affect users. The release process links named fragments to their merged pull requests.

Features

This plugin adds support for Hugo-specific markdown syntax:

Shortcode Formatting

Hugo shortcodes are formatted with normalized whitespace.

Input:

{{<  ref   "documentation.md"  >}}
{{%   note   %}}

Output:

{{< ref "documentation.md" >}}
{{% note %}}

Both {{< >}} (no markdown processing) and {{% %}} (markdown processed) shortcode styles are supported.

Markdown Attributes

Hugo extends standard Markdown with markdown attributes -- a syntax for attaching HTML attributes (IDs, classes, and key-value pairs) to rendered elements. Attributes are written in curly braces after the element they modify, e.g., {#my-id .my-class key=value}.

This plugin normalizes attribute order and formatting:

  1. IDs (#id) come first
  2. Classes (.class) follow, sorted alphabetically
  3. Key-value pairs (key=value) come last, sorted alphabetically by key
  4. Values containing spaces or = are quoted: key="hello world"; otherwise unquoted: key=value

Headings:

## Introduction {.zebra .apple #intro}

Formats to:

## Introduction {#intro .apple .zebra}

Images:

![Logo](logo.png){width=300 .img-fluid height=200}

Formats to:

![Logo](logo.png){.img-fluid height=200 width=300}

Code blocks:

```python {linenos=table .highlight #code}
def hello():
    print("world")
```

Formats to:

```python {#code .highlight linenos=table}
def hello():
    print("world")
```

Additional Features

This plugin bundles support for Hugo markdown features and code block formatting via dependencies:

Markdown syntax:

Code block formatting:

Usage

mdformat content/

Metadata

Release files for mdformat-hugo 0.3.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-hugo 0.3.3
File Size Uploaded Provenance Actions
mdformat_hugo-0.3.3.tar.gz 26.2 kB With provenance Details for mdformat_hugo-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mdformat-hugo 0.3.3
File Interpreter ABI Platform Actions
mdformat_hugo-0.3.3-py3-none-any.whl Python 3 none any Details for mdformat_hugo-0.3.3-py3-none-any.whl

Total release size: 35.0 kB

Release files / mdformat_hugo-0.3.3.tar.gz

Download URL mdformat_hugo-0.3.3.tar.gz
Size 26.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2fe4a8eca56771af57b88ad02fd35b1b2ca66d866033209c71827ca8488f1c6e
BLAKE2b-256 checksum
How to use checksums
e532f28de1f9b9912a48673aa2bba0f9f4c908ff4e1b500ea1a8b5bae833d785
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 19, 2026.

Transparency log

Release files / mdformat_hugo-0.3.3-py3-none-any.whl

Download URL mdformat_hugo-0.3.3-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
703dfc555bfa7d7328c2fd0b64235a142662519f33dc796d09693c31b119b421
BLAKE2b-256 checksum
How to use checksums
2ef5a6578b564afb603f66cef7e904caf6fed8729b5532afa9af708e84ac1f18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 19, 2026.

Transparency log

Security for mdformat-hugo 0.3.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_hugo-0.3.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 Oct 19, 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