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.2.0.tar.gz (12.6 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.2.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mdformat_hugo-0.2.0.tar.gz
  • Upload date:
  • Size: 12.6 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.2.0.tar.gz
Algorithm Hash digest
SHA256 42f91f467c14e59b26088a13e2aca7837c8fd4146f29e6ca57daea7cbacfdd7e
MD5 e6edc6d7ef8ebf5eccc8825420beb029
BLAKE2b-256 15ce1def1a69cbeb888379e425bd83c311efe3540a925abc84d35041c923111f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mdformat_hugo-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: mdformat_hugo-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c08efe03e6c280c810596a2e4e24c6ac9a0fefb9db504562b1b728fa6def2d20
MD5 999bbe1a9ea3703967fd4afd09c4f3ff
BLAKE2b-256 f32912b724bb9d556f003ecb36e481c63334f58f498092beba39bddd20d08d42

See more details on using hashes here.

Provenance

The following attestation bundles were made for mdformat_hugo-0.2.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

0.3.0

2 files

This release

0.2.0 This release

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