Skip to main content

mdformat-directives

An mdformat plugin for generic directives, the :::name[label]{key="value"} syntax of remark-directive and dokk:

:::note[A title]{kind="info"}
Markdown inside is **formatted**; the fences stay where they are.
:::

::install[dokk[search]]

Without it, mdformat sees ::: as text: it pulls closing fences into lists and reflows the blocks.

Install

pipx install mdformat
pipx inject mdformat mdformat-directives

Use

mdformat docs
  • Blocks :::name (three or more colons) are kept, with the Markdown inside formatted. To nest, give the outer block more colons; the count is kept.
  • One-line directives ::name[label]{attrs} are kept as written.
  • Text directives such as :badge[New]{variant="secondary"} are kept as written, also where another plugin would escape their colon.

Raw blocks

Some blocks hold data, not Markdown, such as .env lines whose columns line up. Keep their body exactly as written in .mdformat.toml:

[plugin.directives]
raw = ["env", "bench"]

or on the command line: mdformat --raw-directives env,bench docs.

Development

uv sync --all-extras
make lint   # ruff fix and format, ty, pytest

Releasing

The version comes from the git tag (hatch-vcs); there is nothing to bump. Push a tag such as v0.1.0 and .github/workflows/release.yml builds the wheel and sdist and tests the wheel. Once the pypi environment is approved, it publishes to PyPI and creates the GitHub release.

Before the first release, on PyPI add a trusted publisher (pending publisher) for this repository, workflow release.yml, environment pypi; on GitHub create the pypi environment with a required reviewer (Settings > Environments).

Metadata

Release files for mdformat-directives 0.0.1

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-directives 0.0.1
File Size Uploaded
mdformat_directives-0.0.1.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mdformat-directives 0.0.1
File Interpreter ABI Platform
mdformat_directives-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / mdformat_directives-0.0.1.tar.gz

Download URL mdformat_directives-0.0.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
51e3e3f8cc23549237827abaf5dc858da04360671db9ae8e5354771bc8f41aad
BLAKE2b-256 checksum
How to use checksums
723345fab67adc5fd9fcea4f9fb01b63bb8f3cefff4b1b3bd700552d16ad11e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mdformat_directives-0.0.1-py3-none-any.whl

Download URL mdformat_directives-0.0.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1702d619b84da604bf13c34af01bcc039086250baa16afa25b600aa487cd43d
BLAKE2b-256 checksum
How to use checksums
21ae3a453ec9fa2dec509860c95798b197588a40bd4c659e9e17a6698da13b49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.0.1 This release

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