myform
Status:
myform 0.7.0is public on PyPI. The current development branch prepares the next release; expect breaking changes there.
myform is a universal docs-format translator built around one absolute, typed document tree.
It reads MyST Markdown and GitHub Flavored Markdown (GFM), then writes idiomatic MyST, GFM, Sphinx reStructuredText, or Typst.
Formatting is the identity case: myform.convert(text, format, format) runs through the same reader, typed tree, and writer as a cross-format conversion.
| Format | Read | Write |
|---|---|---|
| MyST Markdown | Yes | Yes |
| GFM | Yes | Yes |
| Sphinx reStructuredText | No | Yes |
| Typst | No | Yes |
The two Markdown identity conversions remain the compatibility rail. They produce byte-for-byte the same text as the existing mdformat pipelines, including the MyST opinions developed in this repository.
Install
Install the public release from PyPI:
pip install myform
To develop from the checked-out source with uv:
uv sync --all-extras
uv run myform --help
myform 0.7.0 does not include a native Typst reader; Typst remains write-only as the format table shows.
The current development branch is preparing that next-release reader behind a native extension.
Its source builds require Rust 1.92.
The development release pipeline intentionally produces one audited cp313-abi3-manylinux_2_28_x86_64 wheel; macOS, Windows, non-x86_64 Linux, and older-glibc Linux systems must build from source until a verified wheel matrix is added.
import myform itself remains pure Python and does not load the extension.
Translate documents
uv run myform convert guide.md --from myst --to rst -o guide.rst
printf '# Hello\n' | uv run myform convert - --from gfm --to typst
uv run myform convert guide.md --from myst --to gfm --report json >guide.gfm
Use - as the input path to read stdin.
Output goes to stdout unless -o/--output names a file.
Conversion reports always go to stderr, keeping document output safe for pipelines.
Choose --report summary (the default), --report json, or --report none.
Format documents
The format verb performs an identity conversion:
uv run myform format README.md
uv run myform format README.md --format myst -o README.formatted.md
The Python API exposes the same contract:
import myform
rst = myform.convert(source, 'myst', 'rst')
formatted = myform.convert(source, 'myst', 'myst')
Configure translation
myform discovers the nearest myform.yaml, .myform.yaml, or [tool.myform] table by walking upward from the target path.
Within one directory, that order is also the precedence order.
The nearest directory wins rather than merging several files.
degrade:
mode: annotate
comments: true
assist:
enabled: false
typst:
postformat: off
extensions: []
Every non-native conversion is represented in the conversion report.
The default annotate degradation mode also leaves a provenance comment when the target supports comments; silent suppresses comments but not reports, while strict refuses carrying or dropping unsupported constructs.
The optional LM assist is degradation-only and disabled by default, which makes zero network calls. When enabled, it uses the configured local OpenAI-compatible gateway and retains a deterministic fallback.
The committed myform.schema.json and myst-options.schema.json schemas describe the translator and mdformat-facade configuration surfaces.
Refresh or verify both with:
uv run myform-write-schema
uv run myform-write-schema --check
Use the MyST mdformat facade
The original plugin remains available through mdformat's myst extension entry point:
uv run mdformat README.md
This repository began as a ground-up rewrite of mdformat-myst, written to make uncompiled MyST documents look closer to the hand-formatted sources maintained by the MyST team.
That facade remains useful on its own:
-
Targets hug the headings or blocks they identify instead of being separated by an extra blank line.
-
Directive options prefer the readable
:key: valueprefix form and escalate to a YAML block only when necessary. -
Directive contents are formatted as first-class Markdown rather than treated as opaque text.
-
Parser and renderer rules are explicit, decorator-registered examples of a modern mdformat extension.
-
YAML values use
srsly's maintainedruamel.yamlintegration. -
The optional
sembrmode reflows paragraphs to one sentence per line without changing their rendered output:[plugin.myst] sembr = true
Enable it per invocation with
mdformat --sembr <filename>;--no-sembroverrides the TOML setting.
The facade also preserves established skip-formatting comments:
<!-- myform-ignore -->
This next block is left exactly as written.
<!-- myform-ignore-start -->
Every block in this range is preserved.
<!-- myform-ignore-end -->
<!-- myform-ignore-file -->
The markers act at the document top level.
Their strings remain configurable through [plugin.myst].
Documentation
Release files for myform 0.8.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| myform-0.8.5.tar.gz | 370.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| myform-0.8.5-cp313-abi3-manylinux_2_28_x86_64.whl | CPython 3.13 | abi3 | Linux glibc 2.28+ x86-64 | Details |
Total release size: 897.8 kB
Release files / myform-0.8.5.tar.gz
| Download URL | myform-0.8.5.tar.gz |
|---|---|
| Size | 370.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf99178c3432893ae7d0e7ea1cc53d2f3fa1c28f3d4e15e1cca244cb03781b5e
|
|
BLAKE2b-256 checksum How to use checksums |
c4e26a80099fec18d4874fd99256225858e25a3a60ea1170b0a97524077142c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / myform-0.8.5-cp313-abi3-manylinux_2_28_x86_64.whl
| Download URL | myform-0.8.5-cp313-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 526.8 kB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0df30f244588f863d3150cc9088459f1d9a3beee8daac73e5508cdac36c984d6
|
|
BLAKE2b-256 checksum How to use checksums |
e0f92161f1a4414cfd45a1822fe9b3b8e3683d17c48fa324c8917b5a7ef2254f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|