pypi / myst-parser
myst-parser
What changed in myst-parser 4 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-12-05.
15 breaking1 security1 deprecations6 new APIs and options7 behavior and defaults15 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initmyst-parser 541 changes
Breaking changes 12
Directives now receive the full fenced text, matching reStructuredText, so errors that echo it show the whole fence.
The offset is now
-1when a directive body starts on the opening line.heading_slug_func,update_mathjax,mathjax_classes,suppress_warnings, andinventoriesin document front matter now warn and are ignored.Duplicate heading slugs now use fixed-base suffixes such as
x,x-1,x-2; links to old third-or-later duplicate slugs no longer resolve.Image alt text preserves backslash escapes and entities; HTML image alt text is kept exactly, and a valueless
altis empty rather thanNone.myst-parser and myst-docutils now require
mdit-py-plugins>=0.7,<1.Each line now retains its indentation, and two trailing spaces no longer create a hard line break.
Warnings and nodes now report corrected source lines, including text nodes, included files, and directive bodies; gettext
.potlocations can change.Requires docutils >=0.20,<0.23, dropping 0.19 and allowing 0.22.
Updates the required markdown-it-py version to ~=4.0 from v3.
Requires Python >=3.11, dropping Python 3.10, and adds support for Python 3.14.
Requires Sphinx >=8,<10, dropping Sphinx 7 and adding Sphinx 9 support.
Security 1
Deeply nested HTML, malformed or hostile YAML front matter, and YAML alias bombs now warn instead of aborting the build.
Deprecations 1
Deprecated in favor of
myst_parser.slugs.github_slugify.
New APIs and options 6
A document's own front matter is now available to its substitutions as
env.metadata[env.docname].Adds
--slug-functo select the slug function used by the command.Emits heading slugs as secondary HTML ids so fragment links using the slug work in published HTML; set it to
Falseto emit only the docutils id.Supports named heading slug presets:
github,gitlab, anddocutils.A shared slug module provides heading slug implementations, including the GitHub, GitLab, and docutils presets.
Adds a syntax extension for section-sign references such as
§1.1, linking to the correspondingly numbered heading in the current document.
Behavior and default changes 7
Warnings point to the offending option's line, and unknown options are reported in separate warnings rather than one aggregate warning.
The supported docutils range is widened to
>=0.20,<0.24, including support for docutils 0.23.An explicit
(target)=before a heading becomes the section's primary id, while the implicit heading id remains a secondary anchor.A
{table}caption can now wrap onto following lines.The mode now includes GFM autolinks and alerts, with improved strikethrough and tasklist handling.
Warnings now use the docname instead of the source path in their locations.
Improves generation of meta nodes.
Fixes and other changes 14
Invalid aliased image attributes such as
{w=…}now produce a warning instead of raising.Link titles are now preserved when links pass through cross-reference resolution.
Links such as
[](doc.md#label)now resolve to explicit targets in other documents without a false missing-reference warning, using the target's title as link text.A footnote whose label equals a heading's name is retained instead of being dropped with a warning.
Previously unresolved same-document and cross-document links now resolve when their implicit anchor exists; cross-document label links use the target's title as link text.
When
linkify-it-pyis not installed, linkify is disabled with amyst.linkifywarning instead of crashing.Blank lines at the start and end of math block content are removed, fixing LaTeX output.
Writes the correctly spelled
rel="noreferrer"and no longer overwrites an authoredtargetorrel.Can now run twice, allowing both
myst_parserandmyst_nbto be listed in Sphinx extensions.Remote inventory fetches now send a User-Agent, avoiding HTTP 403 responses from Read the Docs.
Substitution keys that are not Jinja2 identifiers, such as
{{foo-bar}}, are now allowed.Parsing now stops at colon fences, fixing nested colon fence directives.
Ampersands in Markdown URLs are correctly encoded by not HTML-escaping refuri.
Improves MathJax 4 compatibility for Sphinx 9.
myst-parser 44 changes
Breaking changes 3
Support Docutils versions 0.19 and later, but below 0.22.
Support Python 3.10 and later.
Support Sphinx versions 7 and later, but below 9.
Fixes and other changes 1
Footnote definition and reference warnings and translations are improved.