myst_parser.mdit_to_docutils.transforms#
Directives that can be applied to both Sphinx and docutils.
1. Module Contents#
1.1. Classes#
Detect unreferenced footnotes and emit warnings. |
|
Sort auto-numbered, labelled footnotes by the order they are referenced. |
|
Transform to move footnotes to the end of the document, and sort by label. |
|
Emit each heading’s anchor slug as an additional (secondary) id. |
|
Reorder |
|
Transform for resolving [name](#id) type links. |
1.2. API#
- class myst_parser.mdit_to_docutils.transforms.UnreferencedFootnotesDetector(document, startnode=None)[source]#
Bases:
docutils.transforms.TransformDetect unreferenced footnotes and emit warnings.
Replicates sphinx-doc/sphinx#12730, but also allows for use in docutils (without sphinx).
Initialization
Initial setup for in-place document transforms.
- default_priority = None#
- class myst_parser.mdit_to_docutils.transforms.SortFootnotes(document, startnode=None)[source]#
Bases:
docutils.transforms.TransformSort auto-numbered, labelled footnotes by the order they are referenced.
This is run before the docutils
Footnotetransform, where numbered labels are assigned.Initialization
Initial setup for in-place document transforms.
- default_priority = None#
- class myst_parser.mdit_to_docutils.transforms.CollectFootnotes(document, startnode=None)[source]#
Bases:
docutils.transforms.TransformTransform to move footnotes to the end of the document, and sort by label.
Initialization
Initial setup for in-place document transforms.
- default_priority = None#
- class myst_parser.mdit_to_docutils.transforms.AddSlugIds(document, startnode=None)[source]#
Bases:
docutils.transforms.TransformEmit each heading’s anchor slug as an additional (secondary) id.
This makes the anchor actually exist in published HTML output.
It must run only after all other id assignment — docutils’
PropagateTargets(260) and sphinx’sSortIds(261) included — so that a slug can neither claim an id another element would otherwise receive, nor become a section’s primary id: primary ids (used by tocs, permalinks andobjects.inv) are unchanged by this transform. Slugs are registered indocument.idsdirectly (not viaset_id), deliberately bypassingid_prefix: the raw slug is the anchor.Initialization
Initial setup for in-place document transforms.
- default_priority = 700#
- class myst_parser.mdit_to_docutils.transforms.PrioritiseExplicitIds(document, startnode=None)[source]#
Bases:
docutils.transforms.TransformReorder
section["ids"]so an explicitly named target’s id is first.Docutils’
PropagateTargets(priority 260) appends propagated target ids after the section’s implicit id, so themes, tocs, permalinks andobjects.invpick up the (unstable) implicit id. This moves the explicitly named id earliest in the id list (for multiple(name)=targets, that is the one nearest the heading) to the front; the implicit id remains in the list, as a secondary anchor, so previously published fragments keep working.Initialization
Initial setup for in-place document transforms.
- default_priority = 262#