mdformat-hugo
Mdformat plugin for Hugo-flavored Markdown. Formats Hugo content files while preserving shortcodes and markdown attributes.
See the changelog for released changes. Pull requests need a changelog.d/<PR>.<type>.md fragment; use
the skip news label for changes that do not need release notes.
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:
- IDs (
#id) come first - Classes (
.class) follow, sorted alphabetically - Key-value pairs (
key=value) come last, sorted alphabetically by key - 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:
{width=300 .img-fluid height=200}
Formats to:
{.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:
- mdformat-gfm - GFM tables, strikethrough, task lists, autolinks
- mdformat-front-matters - TOML/YAML/JSON frontmatter
- mdformat-gfm-alerts - Blockquote alerts (
[!NOTE],[!WARNING]),[!NOTE] Title) - mdformat-footnote - Pandoc-style footnotes
- mdformat-deflist - Definition lists
Code block formatting:
- mdformat-ruff - Format Python code blocks with ruff
- mdformat-shfmt - Format shell code blocks with shfmt
- mdformat-config - Format JSON, YAML, TOML code blocks
- mdformat-web - Format HTML, CSS, JavaScript code blocks
- mdformat-pyproject - Format pyproject.toml in code blocks
Usage
mdformat content/
Metadata
Release files for mdformat-hugo 0.3.1
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 |
|---|---|---|---|---|
| mdformat_hugo-0.3.1.tar.gz | 15.3 kB | With provenance | Details for mdformat_hugo-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mdformat_hugo-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for mdformat_hugo-0.3.1-py3-none-any.whl |
Total release size: 24.1 kB
Release files / mdformat_hugo-0.3.1.tar.gz
| Download URL | mdformat_hugo-0.3.1.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef9a28f58042b816758fa80867473bed8ddcfc0cf78497c67a9e4f834deca8e7
|
|
BLAKE2b-256 checksum How to use checksums |
be300ca49d7b7360a9b528fbe6aeea72d06375673cf67ad1ee7f54e4148b1acd
|
| 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 18, 2026.
Transparency logRelease files / mdformat_hugo-0.3.1-py3-none-any.whl
| Download URL | mdformat_hugo-0.3.1-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c52f87f8dc85e79719f99e1f5a2ca18898429212d39d7f13e0d9d39c8c5320d
|
|
BLAKE2b-256 checksum How to use checksums |
da5a4e46b66625fd5b94c26ca97242674e39238714eff57ed37162f97c364417
|
| 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 18, 2026.
Transparency logSecurity for mdformat-hugo 0.3.1
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.
Attestation for mdformat_hugo-0.3.1.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 18, 2026.
Transparency logA 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.