mdformat-hugo 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "daily"
@@ -0,0 +1,5 @@
1
+ changelog:
2
+ exclude:
3
+ authors:
4
+ - dependabot[bot]
5
+ - pre-commit-ci[bot]
@@ -0,0 +1,76 @@
1
+ name: ๐Ÿงช check
2
+ on:
3
+ workflow_dispatch:
4
+ push:
5
+ branches: ["main"]
6
+ pull_request:
7
+ schedule:
8
+ - cron: "0 8 * * *"
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress: true
12
+ jobs:
13
+ test:
14
+ name: ๐Ÿงช test ${{ matrix.py }} - ${{ matrix.os }}
15
+ if: github.event_name != 'schedule' || github.repository_owner == 'gaborbernat'
16
+ runs-on: ${{ matrix.os }}
17
+ timeout-minutes: 40
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ py:
22
+ - "3.14"
23
+ - "3.13"
24
+ - "3.12"
25
+ - "3.11"
26
+ os:
27
+ - ubuntu-24.04
28
+ - macos-15
29
+ - windows-2025
30
+ steps:
31
+ - name: ๐Ÿš€ Install uv
32
+ uses: astral-sh/setup-uv@v7
33
+ - name: ๐Ÿ“ฅ Checkout code
34
+ uses: actions/checkout@v6
35
+ with:
36
+ fetch-depth: 0
37
+ - name: ๐Ÿ“ฆ Install tox with tox-uv
38
+ run: uv tool install --managed-python --python 3.14 tox --with tox-uv
39
+ - name: ๐Ÿ Setup Python for test ${{ matrix.py }}
40
+ run: uv python install ${{ matrix.py }}
41
+ - name: ๐Ÿ—๏ธ Setup test suite
42
+ run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py }}
43
+ - name: ๐Ÿƒ Run test suite
44
+ run: tox run --skip-pkg-install -e ${{ matrix.py }}
45
+ timeout-minutes: 20
46
+ env:
47
+ PYTEST_ADDOPTS: "-vv --durations=20"
48
+ CI_RUN: "yes"
49
+ DIFF_AGAINST: HEAD
50
+ check:
51
+ name: ๐Ÿ”Ž check ${{ matrix.tox_env }} - ${{ matrix.os }}
52
+ if: github.event_name != 'schedule' || github.repository_owner == 'gaborbernat'
53
+ runs-on: ${{ matrix.os }}
54
+ strategy:
55
+ fail-fast: false
56
+ matrix:
57
+ tox_env:
58
+ - dev
59
+ - type
60
+ - pkg_meta
61
+ os:
62
+ - ubuntu-24.04
63
+ - windows-2025
64
+ steps:
65
+ - name: ๐Ÿš€ Install uv
66
+ uses: astral-sh/setup-uv@v7
67
+ - name: ๐Ÿ“ฆ Install tox
68
+ run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv
69
+ - name: ๐Ÿ“ฅ Checkout code
70
+ uses: actions/checkout@v6
71
+ with:
72
+ fetch-depth: 0
73
+ - name: ๐Ÿ—๏ธ Setup check suite
74
+ run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.tox_env }}
75
+ - name: ๐Ÿƒ Run check for ${{ matrix.tox_env }}
76
+ run: tox run --skip-pkg-install -e ${{ matrix.tox_env }}
@@ -0,0 +1,44 @@
1
+ name: Release to PyPI
2
+ on:
3
+ push:
4
+ tags: ["*"]
5
+ env:
6
+ dists-artifact-name: python-package-distributions
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: ๐Ÿ“ฅ Checkout code
12
+ uses: actions/checkout@v6
13
+ with:
14
+ fetch-depth: 0
15
+ - name: ๐Ÿš€ Install the latest version of uv
16
+ uses: astral-sh/setup-uv@v7
17
+ with:
18
+ cache-dependency-glob: "pyproject.toml"
19
+ - name: ๐Ÿ“ฆ Build package
20
+ run: uv build --python 3.14 --python-preference only-managed --sdist --wheel . --out-dir dist
21
+ - name: ๐Ÿ“ค Store the distribution packages
22
+ uses: actions/upload-artifact@v6
23
+ with:
24
+ name: ${{ env.dists-artifact-name }}
25
+ path: dist/*
26
+ release:
27
+ needs:
28
+ - build
29
+ runs-on: ubuntu-latest
30
+ environment:
31
+ name: release
32
+ url: https://pypi.org/project/mdformat-hugo/${{ github.ref_name }}
33
+ permissions:
34
+ id-token: write
35
+ steps:
36
+ - name: ๐Ÿ“ฅ Download all the dists
37
+ uses: actions/download-artifact@v7
38
+ with:
39
+ name: ${{ env.dists-artifact-name }}
40
+ path: dist/
41
+ - name: ๐Ÿš€ Publish to PyPI
42
+ uses: pypa/gh-action-pypi-publish@v1.13.0
43
+ with:
44
+ attestations: true
@@ -0,0 +1,10 @@
1
+ *.egg-info/
2
+ *.py[cod]
3
+ .coverage
4
+ .pytest_cache/
5
+ .tox/
6
+ __pycache__/
7
+ build/
8
+ dist/
9
+ htmlcov/
10
+ src/mdformat_hugo/version.py
@@ -0,0 +1,49 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.0.0
4
+ hooks:
5
+ - id: end-of-file-fixer
6
+ - id: trailing-whitespace
7
+ - id: file-contents-sorter
8
+ files: "^.gitignore$"
9
+ - id: check-case-conflict
10
+ - id: check-added-large-files
11
+ - repo: https://github.com/rhysd/actionlint
12
+ rev: "v1.7.10"
13
+ hooks:
14
+ - id: actionlint
15
+ - repo: https://github.com/codespell-project/codespell
16
+ rev: v2.4.1
17
+ hooks:
18
+ - id: codespell
19
+ additional_dependencies: ["tomli>=2.2.1; python_version < '3.11'"]
20
+ - repo: https://github.com/tox-dev/tox-toml-fmt
21
+ rev: "v1.6.0"
22
+ hooks:
23
+ - id: tox-toml-fmt
24
+ - repo: https://github.com/tox-dev/pyproject-fmt
25
+ rev: "v2.16.0"
26
+ hooks:
27
+ - id: pyproject-fmt
28
+ - repo: https://github.com/astral-sh/ruff-pre-commit
29
+ rev: "v0.15.1"
30
+ hooks:
31
+ - id: ruff-format
32
+ - id: ruff-check
33
+ args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"]
34
+ - repo: https://github.com/google/yamlfmt
35
+ rev: "v0.21.0"
36
+ hooks:
37
+ - id: yamlfmt
38
+ - repo: local
39
+ hooks:
40
+ - id: mdformat
41
+ name: mdformat
42
+ entry: mdformat --wrap 120
43
+ language: python
44
+ types: [markdown]
45
+ additional_dependencies: ["."]
46
+ - repo: meta
47
+ hooks:
48
+ - id: check-hooks-apply
49
+ - id: check-useless-excludes
@@ -0,0 +1,134 @@
1
+ # Contributing to mdformat-hugo
2
+
3
+ Contributions are welcome and appreciated.
4
+
5
+ ## Development Setup
6
+
7
+ Clone the repository:
8
+
9
+ ```bash
10
+ git clone https://github.com/gaborbernat/mdformat-hugo.git
11
+ cd mdformat-hugo
12
+ ```
13
+
14
+ Create development environment:
15
+
16
+ ```bash
17
+ tox -e dev
18
+ ```
19
+
20
+ This creates a `.tox/dev` virtual environment with all dependencies installed in editable mode.
21
+
22
+ ## Running Tests
23
+
24
+ Run all tests across Python versions:
25
+
26
+ ```bash
27
+ tox -e 3.14,3.13,3.12,3.11
28
+ ```
29
+
30
+ Run tests for a specific Python version:
31
+
32
+ ```bash
33
+ tox -e 3.14
34
+ ```
35
+
36
+ Run tests with coverage:
37
+
38
+ ```bash
39
+ tox -e 3.14 # Coverage report shown in output
40
+ ```
41
+
42
+ ## Code Quality
43
+
44
+ Format and lint code:
45
+
46
+ ```bash
47
+ tox -e fix
48
+ ```
49
+
50
+ This runs:
51
+
52
+ - `ruff format` - Code formatting
53
+ - `ruff check --fix` - Linting with auto-fixes
54
+
55
+ Type check:
56
+
57
+ ```bash
58
+ tox -e type
59
+ ```
60
+
61
+ This runs `pyright` in strict mode.
62
+
63
+ ## Code Style
64
+
65
+ - Use Python 3.11+ features (walrus operators, `TYPE_CHECKING` blocks)
66
+ - Follow existing code patterns
67
+ - All code must pass `ruff` strict linting
68
+ - All code must pass `pyright` strict type checking
69
+ - 100% test coverage required
70
+
71
+ ## Writing Tests
72
+
73
+ Tests use snapshot-style testing with `textwrap.dedent`:
74
+
75
+ ```python
76
+ from textwrap import dedent
77
+ import mdformat
78
+
79
+
80
+ def test_example() -> None:
81
+ start = """\
82
+ ## Heading {.class}
83
+ """
84
+ outcome = mdformat.text(dedent(start), extensions=["hugo"])
85
+ expected = """\
86
+ ## Heading {.class}
87
+ """
88
+ assert outcome == dedent(expected)
89
+ ```
90
+
91
+ Test patterns:
92
+
93
+ - One test per behavior
94
+ - Clear test names describing what's being tested
95
+ - Use `dedent()` at usage point, not at variable assignment
96
+ - Test both valid input and edge cases
97
+
98
+ ## Pull Request Process
99
+
100
+ 1. Create a feature branch from `main`
101
+ 1. Make your changes
102
+ 1. Run `tox -e fix` to format and lint
103
+ 1. Run `tox -e 3.14,3.13,3.12,3.11` to verify tests pass
104
+ 1. Run `tox -e type` to verify type checking
105
+ 1. Commit with a descriptive message following Commitizen format
106
+ 1. Push and create a pull request
107
+
108
+ Pull request requirements:
109
+
110
+ - All tests must pass
111
+ - 100% code coverage maintained
112
+ - Type checking passes
113
+ - Linting passes
114
+ - Clear description of changes and motivation
115
+
116
+ ## Project Structure
117
+
118
+ ```
119
+ mdformat-hugo/
120
+ โ”œโ”€โ”€ src/mdformat_hugo/
121
+ โ”‚ โ”œโ”€โ”€ __init__.py # Entry point with version
122
+ โ”‚ โ”œโ”€โ”€ _plugin.py # Plugin interface implementation
123
+ โ”‚ โ”œโ”€โ”€ _renderer.py # Render functions
124
+ โ”‚ โ””โ”€โ”€ _mdit_plugins/ # Custom markdown-it-py plugins
125
+ โ”‚ โ”œโ”€โ”€ attrs.py # Attribute parser (placeholder)
126
+ โ”‚ โ””โ”€โ”€ shortcodes.py # Shortcode preservation
127
+ โ”œโ”€โ”€ tests/ # Test files
128
+ โ”œโ”€โ”€ pyproject.toml # Project configuration
129
+ โ””โ”€โ”€ tox.toml # Tox configuration
130
+ ```
131
+
132
+ ## Questions
133
+
134
+ For questions or discussions, open an issue on GitHub.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bernรกt Gรกbor
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,173 @@
1
+ Metadata-Version: 2.4
2
+ Name: mdformat-hugo
3
+ Version: 0.1.0
4
+ Summary: Mdformat plugin for Hugo-flavored Markdown
5
+ Project-URL: Documentation, https://mdformat-hugo.readthedocs.io
6
+ Project-URL: Homepage, https://github.com/gaborbernat/mdformat-hugo
7
+ Project-URL: Source, https://github.com/gaborbernat/mdformat-hugo
8
+ Project-URL: Tracker, https://github.com/gaborbernat/mdformat-hugo/issues
9
+ Maintainer-email: Bernรกt Gรกbor <gaborjbernat@gmail.com>
10
+ License: MIT License
11
+
12
+ Copyright (c) 2026 Bernรกt Gรกbor
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ License-File: LICENSE
32
+ Keywords: formatter,hugo,markdown,mdformat
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Operating System :: OS Independent
37
+ Classifier: Programming Language :: Python
38
+ Classifier: Programming Language :: Python :: 3 :: Only
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Programming Language :: Python :: 3.13
42
+ Classifier: Programming Language :: Python :: 3.14
43
+ Classifier: Programming Language :: Python :: Implementation :: CPython
44
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
45
+ Requires-Python: >=3.11
46
+ Requires-Dist: markdown-it-py>=3
47
+ Requires-Dist: mdformat-config>=0.1.3
48
+ Requires-Dist: mdformat-deflist>=0.1.2
49
+ Requires-Dist: mdformat-footnote>=0.1.1
50
+ Requires-Dist: mdformat-front-matters>=2
51
+ Requires-Dist: mdformat-gfm-alerts>=1
52
+ Requires-Dist: mdformat-gfm>=1
53
+ Requires-Dist: mdformat-pyproject>=0.0.1
54
+ Requires-Dist: mdformat-ruff>=0.1.3
55
+ Requires-Dist: mdformat-shfmt>=0.1
56
+ Requires-Dist: mdformat-web>=0.1
57
+ Requires-Dist: mdformat>=0.7.17
58
+ Requires-Dist: mdit-py-plugins>=0.4
59
+ Description-Content-Type: text/markdown
60
+
61
+ # mdformat-hugo
62
+
63
+ [![PyPI](https://img.shields.io/pypi/v/mdformat-hugo?style=flat-square)](https://pypi.org/project/mdformat-hugo/)
64
+ [![Supported Python versions](https://img.shields.io/pypi/pyversions/mdformat-hugo.svg)](https://pypi.org/project/mdformat-hugo/)
65
+ [![check](https://github.com/gaborbernat/mdformat-hugo/actions/workflows/check.yaml/badge.svg)](https://github.com/gaborbernat/mdformat-hugo/actions/workflows/check.yaml)
66
+
67
+ Mdformat plugin for Hugo-flavored Markdown. Formats Hugo content files while preserving shortcodes and markdown
68
+ attributes.
69
+
70
+ ## Features
71
+
72
+ This plugin adds support for Hugo-specific markdown syntax:
73
+
74
+ ### Shortcode Formatting
75
+
76
+ Hugo shortcodes are formatted with normalized whitespace.
77
+
78
+ **Input:**
79
+
80
+ ```markdown
81
+ {{< ref "documentation.md" >}}
82
+ {{% note %}}
83
+ ```
84
+
85
+ **Output:**
86
+
87
+ ```markdown
88
+ {{< ref "documentation.md" >}}
89
+ {{% note %}}
90
+ ```
91
+
92
+ Both `{{< >}}` (no markdown processing) and `{{% %}}` (markdown processed) shortcode styles are supported.
93
+
94
+ ### Markdown Attributes
95
+
96
+ Hugo extends standard Markdown with [markdown attributes](https://gohugo.io/content-management/markdown-attributes/) --
97
+ a syntax for attaching HTML attributes (IDs, classes, and key-value pairs) to rendered elements. Attributes are written
98
+ in curly braces after the element they modify, e.g., `{#my-id .my-class key=value}`.
99
+
100
+ This plugin normalizes attribute order and formatting:
101
+
102
+ 1. **IDs** (`#id`) come first
103
+ 1. **Classes** (`.class`) follow, sorted alphabetically
104
+ 1. **Key-value pairs** (`key=value`) come last, sorted alphabetically by key
105
+ 1. Values containing spaces or `=` are quoted: `key="hello world"`; otherwise unquoted: `key=value`
106
+
107
+ **Headings:**
108
+
109
+ ```markdown
110
+ ## Introduction {.zebra .apple #intro}
111
+ ```
112
+
113
+ Formats to:
114
+
115
+ ```markdown
116
+ ## Introduction {#intro .apple .zebra}
117
+ ```
118
+
119
+ **Images:**
120
+
121
+ ```markdown
122
+ ![Logo](logo.png){width=300 .img-fluid height=200}
123
+ ```
124
+
125
+ Formats to:
126
+
127
+ ```markdown
128
+ ![Logo](logo.png){.img-fluid height=200 width=300}
129
+ ```
130
+
131
+ **Code blocks:**
132
+
133
+ ````
134
+ ```python {linenos=table .highlight #code}
135
+ def hello():
136
+ print("world")
137
+ ```
138
+ ````
139
+
140
+ Formats to:
141
+
142
+ ````
143
+ ```python {#code .highlight linenos=table}
144
+ def hello():
145
+ print("world")
146
+ ```
147
+ ````
148
+
149
+ ### Additional Features
150
+
151
+ This plugin bundles support for Hugo markdown features and code block formatting via dependencies:
152
+
153
+ **Markdown syntax:**
154
+
155
+ - [mdformat-gfm](https://github.com/hukkin/mdformat-gfm) - GFM tables, strikethrough, task lists, autolinks
156
+ - [mdformat-front-matters](https://github.com/kyleking/mdformat-front-matters) - TOML/YAML/JSON frontmatter
157
+ - [mdformat-gfm-alerts](https://github.com/KyleKing/mdformat-gfm-alerts) - Blockquote alerts (`[!NOTE]`, `[!WARNING]`)
158
+ - [mdformat-footnote](https://github.com/executablebooks/mdformat-footnote) - Pandoc-style footnotes
159
+ - [mdformat-deflist](https://github.com/executablebooks/mdformat-deflist) - Definition lists
160
+
161
+ **Code block formatting:**
162
+
163
+ - [mdformat-ruff](https://github.com/Freed-Wu/mdformat-ruff) - Format Python code blocks with ruff
164
+ - [mdformat-shfmt](https://github.com/hukkin/mdformat-shfmt) - Format shell code blocks with shfmt
165
+ - [mdformat-config](https://github.com/hukkin/mdformat-config) - Format JSON, YAML, TOML code blocks
166
+ - [mdformat-web](https://github.com/hukkin/mdformat-web) - Format HTML, CSS, JavaScript code blocks
167
+ - [mdformat-pyproject](https://github.com/csala/mdformat-pyproject) - Format pyproject.toml in code blocks
168
+
169
+ ## Usage
170
+
171
+ ```bash
172
+ mdformat content/
173
+ ```
@@ -0,0 +1,113 @@
1
+ # mdformat-hugo
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/mdformat-hugo?style=flat-square)](https://pypi.org/project/mdformat-hugo/)
4
+ [![Supported Python versions](https://img.shields.io/pypi/pyversions/mdformat-hugo.svg)](https://pypi.org/project/mdformat-hugo/)
5
+ [![check](https://github.com/gaborbernat/mdformat-hugo/actions/workflows/check.yaml/badge.svg)](https://github.com/gaborbernat/mdformat-hugo/actions/workflows/check.yaml)
6
+
7
+ Mdformat plugin for Hugo-flavored Markdown. Formats Hugo content files while preserving shortcodes and markdown
8
+ attributes.
9
+
10
+ ## Features
11
+
12
+ This plugin adds support for Hugo-specific markdown syntax:
13
+
14
+ ### Shortcode Formatting
15
+
16
+ Hugo shortcodes are formatted with normalized whitespace.
17
+
18
+ **Input:**
19
+
20
+ ```markdown
21
+ {{< ref "documentation.md" >}}
22
+ {{% note %}}
23
+ ```
24
+
25
+ **Output:**
26
+
27
+ ```markdown
28
+ {{< ref "documentation.md" >}}
29
+ {{% note %}}
30
+ ```
31
+
32
+ Both `{{< >}}` (no markdown processing) and `{{% %}}` (markdown processed) shortcode styles are supported.
33
+
34
+ ### Markdown Attributes
35
+
36
+ Hugo extends standard Markdown with [markdown attributes](https://gohugo.io/content-management/markdown-attributes/) --
37
+ a syntax for attaching HTML attributes (IDs, classes, and key-value pairs) to rendered elements. Attributes are written
38
+ in curly braces after the element they modify, e.g., `{#my-id .my-class key=value}`.
39
+
40
+ This plugin normalizes attribute order and formatting:
41
+
42
+ 1. **IDs** (`#id`) come first
43
+ 1. **Classes** (`.class`) follow, sorted alphabetically
44
+ 1. **Key-value pairs** (`key=value`) come last, sorted alphabetically by key
45
+ 1. Values containing spaces or `=` are quoted: `key="hello world"`; otherwise unquoted: `key=value`
46
+
47
+ **Headings:**
48
+
49
+ ```markdown
50
+ ## Introduction {.zebra .apple #intro}
51
+ ```
52
+
53
+ Formats to:
54
+
55
+ ```markdown
56
+ ## Introduction {#intro .apple .zebra}
57
+ ```
58
+
59
+ **Images:**
60
+
61
+ ```markdown
62
+ ![Logo](logo.png){width=300 .img-fluid height=200}
63
+ ```
64
+
65
+ Formats to:
66
+
67
+ ```markdown
68
+ ![Logo](logo.png){.img-fluid height=200 width=300}
69
+ ```
70
+
71
+ **Code blocks:**
72
+
73
+ ````
74
+ ```python {linenos=table .highlight #code}
75
+ def hello():
76
+ print("world")
77
+ ```
78
+ ````
79
+
80
+ Formats to:
81
+
82
+ ````
83
+ ```python {#code .highlight linenos=table}
84
+ def hello():
85
+ print("world")
86
+ ```
87
+ ````
88
+
89
+ ### Additional Features
90
+
91
+ This plugin bundles support for Hugo markdown features and code block formatting via dependencies:
92
+
93
+ **Markdown syntax:**
94
+
95
+ - [mdformat-gfm](https://github.com/hukkin/mdformat-gfm) - GFM tables, strikethrough, task lists, autolinks
96
+ - [mdformat-front-matters](https://github.com/kyleking/mdformat-front-matters) - TOML/YAML/JSON frontmatter
97
+ - [mdformat-gfm-alerts](https://github.com/KyleKing/mdformat-gfm-alerts) - Blockquote alerts (`[!NOTE]`, `[!WARNING]`)
98
+ - [mdformat-footnote](https://github.com/executablebooks/mdformat-footnote) - Pandoc-style footnotes
99
+ - [mdformat-deflist](https://github.com/executablebooks/mdformat-deflist) - Definition lists
100
+
101
+ **Code block formatting:**
102
+
103
+ - [mdformat-ruff](https://github.com/Freed-Wu/mdformat-ruff) - Format Python code blocks with ruff
104
+ - [mdformat-shfmt](https://github.com/hukkin/mdformat-shfmt) - Format shell code blocks with shfmt
105
+ - [mdformat-config](https://github.com/hukkin/mdformat-config) - Format JSON, YAML, TOML code blocks
106
+ - [mdformat-web](https://github.com/hukkin/mdformat-web) - Format HTML, CSS, JavaScript code blocks
107
+ - [mdformat-pyproject](https://github.com/csala/mdformat-pyproject) - Format pyproject.toml in code blocks
108
+
109
+ ## Usage
110
+
111
+ ```bash
112
+ mdformat content/
113
+ ```