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.

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.0

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.0
File Size Uploaded
mdformat_hugo-0.3.0.tar.gz 12.9 kB Details

Built distribution (wheel)

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

Total release size: 21.5 kB

Release files / mdformat_hugo-0.3.0.tar.gz

Download URL mdformat_hugo-0.3.0.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
15046029ed2db20234849771e7796db9b1067c15d9cfdfbf07cb03e96eadfb05
BLAKE2b-256 checksum
How to use checksums
7b56d440a630998ba48c65ef46771588f34598944933ab1a3c1b860f60040883
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 26, 2026.

Transparency log

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

Download URL mdformat_hugo-0.3.0-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
663588755957af26b60f03853fce25c56e9f75534f84c50aae7bf3cf08a9e0f6
BLAKE2b-256 checksum
How to use checksums
50b72e77c0e91dfc62f36ae3fe4b9f06e399cae954d633e7dab23ba4221c481c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

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