Docutils Transforms (original) (raw)

David Goodger

Contact:

docutils-develop@lists.sourceforge.net

Revision:

10113

Date:

2025-04-29

Copyright:

This document has been placed in the public domain.

Contents

Introduction

Transforms change the document tree in-place, add to the tree, or prune it. Transforms resolve references and footnote numbers, processinterpreted text, and do other context-sensitive processing. Each transform is a subclass of docutils.transforms.Transform.

There are transforms added by components, others (e.g.parts.Contents) are added by the parser, if a corresponding directive is found in the document.

To add a transform, components (objects inheriting fromdocutils.Component like Readers, Parsers, Writers, Input, Output) overwrite the get_transforms() method of their base class. After the Reader has finished processing, the Publisher callsTransformer.populate_from_components() with a list of components and all transforms returned by the component's get_transforms() method are stored in a transformer object attached to the document tree.

For more about transforms and the Transformer object, see also PEP 258. (The default_transforms() attribute of component classes mentioned there is deprecated. Use the get_transforms() method instead.)

Transforms Listed in Priority Order

Transform classes each have a default priority attribute which is used by the Transformer to apply transforms in order (low to high). The default priority can be overridden when adding transforms to the Transformer object.

Transform: module.Class Added By Priority
misc.ClassAttribute "class" (d/p) 210
references.Substitutions standalone (r), pep (r) 220
references.PropagateTargets standalone (r), pep (r) 260
frontmatter.DocTitle standalone (r) 320
frontmatter.DocInfo standalone (r) 340
frontmatter.SectSubTitle standalone (r) 350
peps.Headers pep (r) 360
peps.Contents pep (r) 380
universal.StripClassesAndElements Writer (w) 420
references.AnonymousHyperlinks standalone (r), pep (r) 440
references.IndirectHyperlinks standalone (r), pep (r) 460
peps.TargetNotes pep (r) 520
references.TargetNotes peps.TargetNotes (t/p) 0
misc.CallBack peps.TargetNotes (t/p) 1
references.TargetNotes "target-notes" (d/p) 540
references.Footnotes standalone (r), pep (r) 620
references.ExternalTargets standalone (r), pep (r) 640
references.InternalTargets standalone (r), pep (r) 660
parts.SectNum "sectnum" (d/p) 710
parts.Contents "contents" (d/p), peps.Contents (t/p) 720
universal.StripComments Reader (r) 740
peps.PEPZero peps.Headers (t/p) 760
components.Filter not used 780
universal.Decorations Reader (r) 820
misc.Transitions standalone (r), pep (r) 830
universal.Validate Parser 835
universal.ExposeInternals Reader (r) 840
references.DanglingReferences standalone (r), pep (r) 850
universal.SmartQuotes Parser 855
universal.Messages Writer (w) 860
universal.FilterMessages Writer (w) 870
universal.TestMessages DocutilsTestSupport 880
writer_aux.Compound not used, to be removed 910
writer_aux.Admonitions _html_base (w), latex2e (w) 920
misc.CallBack n/a 990

Key:

Transform Priority Range Categories

Priority
From To Category
0 99 immediate execution (added by another transform)
100 199 very early (non-standard)
200 299 very early
300 399 early
400 699 main
700 799 late
800 899 very late
900 999 very late (non-standard)

Transforms added by components

readers.Reader:

universal.Decorations,

universal.ExposeInternals,

universal.StripComments

readers.ReReader:

None

readers.standalone.Reader:

references.Substitutions,

references.PropagateTargets,

frontmatter.DocTitle,

frontmatter.SectionSubTitle,

frontmatter.DocInfo,

references.AnonymousHyperlinks,

references.IndirectHyperlinks,

references.Footnotes,

references.ExternalTargets,

references.InternalTargets,

references.DanglingReferences,

misc.Transitions

readers.pep.Reader:

references.Substitutions,

references.PropagateTargets,

references.AnonymousHyperlinks,

references.IndirectHyperlinks,

references.Footnotes,

references.ExternalTargets,

references.InternalTargets,

references.DanglingReferences,

misc.Transitions,

peps.Headers,

peps.Contents,

peps.TargetNotes

parsers.rst.Parser

universal.SmartQuotes

writers.Writer:

universal.Messages,

universal.FilterMessages,

universal.StripClassesAndElements

writers.UnfilteredWriter

None

writers.latex2e.Writer

writer_aux.Admonitions

writers._html_base.Writer:

writer_aux.Admonitions

writers.odf_odt.Writer:

removes references.DanglingReferences

Transforms Reference

See also Transforms Listed in Priority Orderand the sources in docutils/transforms.

DocInfo

Module:

frontmatter

Added by:

standalone Reader

Default priority:

340

Configuration setting:

docinfo_xform (default: True)

Given a document starting [1] with a field list, the DocInfo transform converts fields with registered bibliographic field names to the corresponding document tree elements becoming child elements of the element (except for "dedication" and "abstract", which become elements after ).

For example, this document fragment:

Document Title <field_list> <field> <field_name> Author <field_body> <paragraph> A. Name <field> <field_name> Status <field_body> <paragraph> <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>R</mi><mi>C</mi><mi>S</mi><mi>f</mi><mi>i</mi><mi>l</mi><mi>e</mi></mrow><annotation encoding="application/x-tex">RCSfile</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.05764em;">RCS</span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">e</span></span></span></span> ... <p>will be transformed to:</p> <document> <title> Document Title <docinfo> <author> A. Name <status> frontmatter.py ... <h3 id="doctitle"><a class="anchor" aria-hidden="true" tabindex="-1" href="#doctitle"><svg class="octicon octicon-link" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><a href="#toc-entry-7" title="null">DocTitle</a><a href="#doctitle" title="link to this section"></a></h3><p>Module:</p> <p><a href="../../docutils/transforms/frontmatter.py" title="null" rel="noopener noreferrer">frontmatter</a></p> <p>Added by:</p> <p>standalone Reader</p> <p>Default <a href="#priority" title="null">priority</a>:</p> <p>320</p> <p><a href="../user/config.html" title="null" rel="noopener noreferrer">Configuration</a> setting:</p> <p><a href="../user/config.html#doctitle-xform" title="null" rel="noopener noreferrer">doctitle_xform</a> (default: True)</p> <p>Under the conditions explained below, the DocTitle transform converts the document's first section title(s) to a document title and subtitle.</p> <ol> <li>If the document contains a single top-level section as its first body element, <a href="#pre-doctitle" title="null">[2]</a> the top-level section's title is used as <a href="../ref/rst/restructuredtext.html#document-title" title="null" rel="noopener noreferrer">document title</a> and default <a href="../ref/doctree.html#title-attribute" title="null" rel="noopener noreferrer">metadata title</a>. The top-level section's contents become the document's immediate contents.</li> <li>If step 1 successfully determines the document title, the transform checks for a subtitle: If the lone top-level section itself contains a single second-level section as its first element, <a href="#pre-doctitle" title="null">[2]</a> that section's title is promoted to the document's subtitle, and that section's contents become the document's immediate contents.</li> </ol> <p>The transform can be disabled with the <a href="../user/config.html#doctitle-xform" title="null" rel="noopener noreferrer">doctitle_xform</a> configuration setting or the corresponding --no-doc-title command line option.</p> <h4 id="examples"><a class="anchor" aria-hidden="true" tabindex="-1" href="#examples"><svg class="octicon octicon-link" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Examples<a href="#examples" title="link to this section"></a></h4><p>The input text</p> <h1 id="top-level-title"><a class="anchor" aria-hidden="true" tabindex="-1" href="#top-level-title"><svg class="octicon octicon-link" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Top-Level Title</h1><p>A paragraph.</p> <p>is parsed to the following document tree:</p> <document> <section names="top-level\ title"> <title> Top-Level Title <paragraph> A paragraph. <p>The DocTitle transform converts it to:</p> <document names="top-level\ title" title="Top-Level Title"> <title> Top-Level Title <paragraph> A paragraph. <p>Given this input with a lone section and sub-section:</p> <h1 id="top-level-title-1"><a class="anchor" aria-hidden="true" tabindex="-1" href="#top-level-title-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Top-Level Title</h1><p>Second-Level Title</p> <pre><code class="notranslate"> A paragraph. the result after parsing and running the DocTitle transform is: <document names="top-level\ title"> <title> Top-Level Title <subtitle names="second-level\ title"> Second-Level Title <paragraph> A paragraph. (Note that the implicit hyperlink target generated by the "Second-Level Title" is preserved on the "subtitle" element itself.) --- The following examples do _not_ comply with the conditions: 1. More than one top-level section: Top-Level Title =============== A paragraph. Another Top-Level Title ======================= Another paragraph. The DocTitle transform will leave the document tree as-is. The document has no title. It is recommended to set the[metadata title](../ref/doctree.html#title-attribute) with the ["title"](../ref/rst/directives.html#title) directive. 2. More than one second-level section: Top-Level Title =============== Second-Level Title </code></pre><h1 id="a-paragraphanother-second-level-titleanother-paragraphstep-2-is-skipped-top-level-title-becomes-the-document-title-second-level-title-and-another-second-level-title-become-titles-of-top-level-sectionsthis-is-what-you-normally-want-in-a-document-with-title-but-no-subtitle-3-body-elements-before-the-first-section-2-note-this-element-would-not-stop-the-transform-if-it-were---nested-in-a-headertop-level-title"><a class="anchor" aria-hidden="true" tabindex="-1" href="#a-paragraphanother-second-level-titleanother-paragraphstep-2-is-skipped-top-level-title-becomes-the-document-title-second-level-title-and-another-second-level-title-become-titles-of-top-level-sectionsthis-is-what-you-normally-want-in-a-document-with-title-but-no-subtitle-3-body-elements-before-the-first-section-2-note-this-element-would-not-stop-the-transform-if-it-were---nested-in-a-headertop-level-title"><svg class="octicon octicon-link" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>A paragraph.<br>Another Second-Level Title<br>~~~~~~~~~~~~~~~~~~~~~~~~~~<br>Another paragraph.<br>Step 2 is skipped. "Top-Level Title" becomes the document title; "Second-Level Title" and "Another Second-Level Title" become titles of top-level sections.<br>This is what you normally want in a document with title but no subtitle. 3. Body elements before the first section: <a href="#pre-doctitle" title="null">[2]</a><br>.. note:: This element would not stop the transform, if it were<br> nested in a header.<br>Top-Level Title </h1><p>A paragraph.<br>The DocTitle transform will leave the document tree as-is. The document has no title. 4. A <a href="../user/config.html" title="null" rel="noopener noreferrer">configuration file</a> entry "doctitle_xform: False" or converting with the CLI command<br>docutils --no-doc-title example.rst > example.html<br>The DocTitle transform is skipped. The document has no title.</p> <h3 id="sectsubtitle"><a class="anchor" aria-hidden="true" tabindex="-1" href="#sectsubtitle"><svg class="octicon octicon-link" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><a href="#toc-entry-8" title="null">SectSubTitle</a><a href="#sectsubtitle" title="link to this section"></a></h3><p>Module:</p> <p><a href="../../docutils/transforms/frontmatter.py" title="null" rel="noopener noreferrer">frontmatter</a></p> <p>Added by:</p> <p>standalone Reader</p> <p>Default <a href="#priority" title="null">priority</a>:</p> <p>350</p> <p><a href="../user/config.html" title="null" rel="noopener noreferrer">Configuration</a> setting:</p> <p><a href="../user/config.html#sectsubtitle-xform" title="null" rel="noopener noreferrer">sectsubtitle_xform</a> (default: False)</p> <p>The SectSubTitle transform works like <a href="#step-2" title="null">step 2</a> of the <a href="#doctitle" title="null">DocTitle</a>transform, but for sections.</p> <p>For example,</p> <section> <title> Title <section> <title> Subtitle ... <p>is transformed into</p> <section> <title> Title <subtitle> Subtitle ... <p>This transform is disabled by default.</p> <h2 id="appendix"><a class="anchor" aria-hidden="true" tabindex="-1" href="#appendix"><svg class="octicon octicon-link" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><a href="#toc-entry-9" title="null">Appendix</a><a href="#appendix" title="link to this section"></a></h2><h3 id="prebibliographic-elements"><a class="anchor" aria-hidden="true" tabindex="-1" href="#prebibliographic-elements"><svg class="octicon octicon-link" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><a href="#toc-entry-10" title="null">PreBibliographic Elements</a><a href="#prebibliographic-elements" title="link to this section"></a></h3><p>The document tree elements <a href="../ref/doctree.html#comment" title="null" rel="noopener noreferrer"><comment></a>, <a href="../ref/doctree.html#decoration" title="null" rel="noopener noreferrer"><decoration></a>,<a href="../ref/doctree.html#footer" title="null" rel="noopener noreferrer"><footer></a>, <a href="../ref/doctree.html#header" title="null" rel="noopener noreferrer"><header></a>, <a href="../ref/doctree.html#meta" title="null" rel="noopener noreferrer"><meta></a>, <a href="../ref/doctree.html#pending" title="null" rel="noopener noreferrer"><pending></a>, <a href="../ref/doctree.html#raw" title="null" rel="noopener noreferrer"><raw></a>,<a href="../ref/doctree.html#substitution-definition" title="null" rel="noopener noreferrer"><substitution_definition></a>, <a href="../ref/doctree.html#subtitle" title="null" rel="noopener noreferrer"><subtitle></a>, <a href="../ref/doctree.html#system-message" title="null" rel="noopener noreferrer"><system_message></a>,<a href="../ref/doctree.html#target" title="null" rel="noopener noreferrer"><target></a>, and <a href="../ref/doctree.html#title" title="null" rel="noopener noreferrer"><title></a> are ignored when the <a href="#doctitle" title="null">DocTitle</a> and <a href="#docinfo" title="null">DocInfo</a>transforms check for elements before frontmatter candidates.</p> <p>This means that in the reStructuredText source, <a href="../ref/rst/restructuredtext.html#comments" title="null" rel="noopener noreferrer">comments</a>,<a href="../ref/rst/restructuredtext.html#hyperlink-targets" title="null" rel="noopener noreferrer">hyperlink targets</a>, <a href="../ref/rst/restructuredtext.html#substitution-definitions" title="null" rel="noopener noreferrer">substitution definitions</a>, and the <a href="../ref/rst/restructuredtext.html#directives" title="null" rel="noopener noreferrer">directives</a> <a href="../ref/rst/directives.html#class" title="null" rel="noopener noreferrer">"class"</a>, <a href="../ref/rst/directives.html#default-role" title="null" rel="noopener noreferrer">"default-role"</a>, <a href="../ref/rst/directives.html#footer" title="null" rel="noopener noreferrer">"footer"</a>, <a href="../ref/rst/directives.html#header" title="null" rel="noopener noreferrer">"header"</a>, <a href="../ref/rst/directives.html#meta" title="null" rel="noopener noreferrer">"meta"</a>,<a href="../ref/rst/directives.html#raw" title="null" rel="noopener noreferrer">"raw"</a>, <a href="../ref/rst/directives.html#sectnum" title="null" rel="noopener noreferrer">"sectnum"</a>, <a href="../ref/rst/directives.html#sectnum" title="null" rel="noopener noreferrer">"sectnum"</a>, <a href="../ref/rst/directives.html#target-notes" title="null" rel="noopener noreferrer">"target-notes"</a>, and <a href="../ref/rst/directives.html#title" title="null" rel="noopener noreferrer">"title"</a>may be placed before the <a href="../ref/rst/restructuredtext.html#document-title" title="null" rel="noopener noreferrer">document title</a> or <a href="../ref/rst/restructuredtext.html#bibliographic-fields" title="null" rel="noopener noreferrer">bibliographic fields</a>.</p> <p>The <a href="#doctitle" title="null">DocTitle</a> transform inserts document title and subtitle before these elements. <a href="#docinfo" title="null">DocInfo</a> inserts the bibliographic fields before<a href="../ref/doctree.html#comment" title="null" rel="noopener noreferrer"><comment></a>, <a href="../ref/doctree.html#raw" title="null" rel="noopener noreferrer"><raw></a>, <a href="../ref/doctree.html#substitution-definition" title="null" rel="noopener noreferrer"><substitution_definition></a>, and <a href="../ref/doctree.html#target" title="null" rel="noopener noreferrer"><target></a>.</p> <p>For example, the document source:</p> <p>.. a comment .. |today| date:: .. _hypertarget: <a href="http://example.org" title="undefined" rel="noopener noreferrer">http://example.org</a> .. class:: spam .. role:: ham .. default-role:: ham .. footer:: footer text .. header:: header text .. meta:: :test: value .. raw:: html</p> <p> raw html text .. sectnum:: .. target-notes:: .. title:: metadata document title</p> <h1 id="top-level-title-2"><a class="anchor" aria-hidden="true" tabindex="-1" href="#top-level-title-2"><svg class="octicon octicon-link" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Top-Level Title</h1><p>Second-Level Title</p> <p>~~~~~~~~~~~~~~~~~~</p> <p>📅 |today|</p> <p>is parsed and transformed to:</p> <p><document ids="top-level-title" names="top-level\ title" title="metadata document title"> <title> Top-Level Title <subtitle ids="second-level-title" names="second-level\ title"> Second-Level Title <meta content="value" name="test"> <decoration> <header> <paragraph> header text <footer> <paragraph> footer text <docinfo> <date> 2024-03-01 <comment xml:space="preserve"> a comment <substitution_definition names="today"> 2024-03-01 <target ids="hypertarget" names="hypertarget" refuri="http://example.org"> <raw classes="spam" format="html" xml:space="preserve"> raw html text</p>