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/

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdformat_hugo-0.3.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdformat_hugo-0.3.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file mdformat_hugo-0.3.0.tar.gz.

File metadata

  • Download URL: mdformat_hugo-0.3.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for mdformat_hugo-0.3.0.tar.gz
Algorithm Hash digest
SHA256 15046029ed2db20234849771e7796db9b1067c15d9cfdfbf07cb03e96eadfb05
MD5 25270538eb992018b7df254f2b4e71e8
BLAKE2b-256 7b56d440a630998ba48c65ef46771588f34598944933ab1a3c1b860f60040883

See more details on using hashes here.

Provenance

The following attestation bundles were made for mdformat_hugo-0.3.0.tar.gz:

Publisher: release.yaml on gaborbernat/mdformat-hugo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mdformat_hugo-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: mdformat_hugo-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for mdformat_hugo-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 663588755957af26b60f03853fce25c56e9f75534f84c50aae7bf3cf08a9e0f6
MD5 3d8dcd8cd52d4f9512dad5d3b608e756
BLAKE2b-256 50b72e77c0e91dfc62f36ae3fe4b9f06e399cae954d633e7dab23ba4221c481c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mdformat_hugo-0.3.0-py3-none-any.whl:

Publisher: release.yaml on gaborbernat/mdformat-hugo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page