|
From: <mi...@us...> - 2026-06-18 13:28:11
|
Revision: 10366
http://sourceforge.net/p/docutils/code/10366
Author: milde
Date: 2026-06-18 13:28:08 +0000 (Thu, 18 Jun 2026)
Log Message:
-----------
Change "section_self_link" setting default to True.
The "section_self_link" setting tells the HTML5 writer to
extend section headings with an empty <a> element with a ``href``
to the section.
CSS rules show a link symbol when the mouse hovers over the heading.
Modified Paths:
--------------
trunk/docutils/HISTORY.rst
trunk/docutils/RELEASE-NOTES.rst
trunk/docutils/docs/user/config.rst
trunk/docutils/docutils/writers/html5_polyglot/__init__.py
trunk/docutils/docutils/writers/html5_polyglot/plain.css
trunk/docutils/docutils/writers/html5_polyglot/tuftig.css
trunk/docutils/test/data/help/docutils.rst
trunk/docutils/test/functional/expected/rst_html5_tuftig.html
trunk/docutils/test/functional/expected/standalone_rst_html5.html
trunk/docutils/test/functional/tests/length_units_html5.py
trunk/docutils/test/test_writers/test_html5_template.py
Modified: trunk/docutils/HISTORY.rst
===================================================================
--- trunk/docutils/HISTORY.rst 2026-06-18 13:27:53 UTC (rev 10365)
+++ trunk/docutils/HISTORY.rst 2026-06-18 13:28:08 UTC (rev 10366)
@@ -111,6 +111,9 @@
- Change the default value of the initial_header_level_ setting to "auto"
(<h2> if there is a document title, else <h1>).
+ - Change the default value of the "section_self_link" setting to True.
+ - Add CSS rules for back-link and self-link symbols from
+ "responsive.css" also in "plain.css" and "tuftig.css".
- Use normal font size and colour in CSS for informal titles of type "rubric".
- Use more specific CSS selectors for styling <aside> elements to avoid
problems with other elements using "topic" as class value, e.g. a docinfo
Modified: trunk/docutils/RELEASE-NOTES.rst
===================================================================
--- trunk/docutils/RELEASE-NOTES.rst 2026-06-18 13:27:53 UTC (rev 10365)
+++ trunk/docutils/RELEASE-NOTES.rst 2026-06-18 13:28:08 UTC (rev 10366)
@@ -104,9 +104,6 @@
* "html5" writer:
- - The default of the self-link_ configuration setting will change to
- "True" in Docutils 1.0.
-
- Prefer explicit reference names as base for an HTML element's ID
in Docutils 1.0. No change for internal cross-references.
Cf. `Sphinx issue #1961`__
@@ -231,6 +228,7 @@
Configuration changes:
- `Auto-detection`_ of the input encoding is no longer supported.
The input_encoding_ value ``None`` now stands for "utf-8".
+ - The section_self_link_ setting now defaults to True.
- The use_latex_citations_ setting now defaults to True.
- The legacy_column_widths_ setting now defaults to False.
- The initial_header_level_ setting default for the HTML5 writer
Modified: trunk/docutils/docs/user/config.rst
===================================================================
--- trunk/docutils/docs/user/config.rst 2026-06-18 13:27:53 UTC (rev 10365)
+++ trunk/docutils/docs/user/config.rst 2026-06-18 13:28:08 UTC (rev 10366)
@@ -1532,7 +1532,7 @@
the section. See ``responsive.css`` for an example how this can be
styled to show a symbol allowing users to copy the section's URL.
-:Default: False.
+:Default: True (since Docutils 1.0).
:Options: ``--section-self-link``, ``--no-section-self-link``.
New in Docutils 0.18.
Modified: trunk/docutils/docutils/writers/html5_polyglot/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/__init__.py 2026-06-18 13:27:53 UTC (rev 10365)
+++ trunk/docutils/docutils/writers/html5_polyglot/__init__.py 2026-06-18 13:28:08 UTC (rev 10366)
@@ -97,10 +97,10 @@
{'metavar': '<strategy>', 'choices': ('embed', 'link', 'lazy'),
# 'default': 'link' # default set in _html_base.py
}),
- ('Append a self-link to section headings.',
+ ('Append a self-link to section headings. (default)',
['--section-self-link'],
- {'default': False, 'action': 'store_true'}),
- ('Do not append a self-link to section headings. (default)',
+ {'default': True, 'action': 'store_true'}),
+ ('Do not append a self-link to section headings.',
['--no-section-self-link'],
{'dest': 'section_self_link', 'action': 'store_false'}),
)
Modified: trunk/docutils/docutils/writers/html5_polyglot/plain.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/plain.css 2026-06-18 13:27:53 UTC (rev 10365)
+++ trunk/docutils/docutils/writers/html5_polyglot/plain.css 2026-06-18 13:28:08 UTC (rev 10366)
@@ -295,6 +295,17 @@
/* Hyperlink References */
a { text-decoration: none; }
+*:hover > a.toc-backref:after,
+.topic-title:hover > a:after {
+ content: " \2191"; /* ↑ UPWARDS ARROW */
+ color: grey;
+}
+*:hover > a.self-link:after {
+ content: "\1F517"; /* LINK SYMBOL */
+ color: grey;
+ font-size: smaller;
+ margin-left: 0.2em;
+}
/* External Targets */
/* span.target.external */
Modified: trunk/docutils/docutils/writers/html5_polyglot/tuftig.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/tuftig.css 2026-06-18 13:27:53 UTC (rev 10365)
+++ trunk/docutils/docutils/writers/html5_polyglot/tuftig.css 2026-06-18 13:28:08 UTC (rev 10366)
@@ -334,6 +334,17 @@
a:link:hover {
text-decoration: underline;
}
+*:hover > a.toc-backref:after,
+.topic-title:hover > a:after {
+ content: " \2191"; /* ↑ UPWARDS ARROW */
+ color: grey;
+}
+*:hover > a.self-link:after {
+content: "\26AD"; /* MARRIAGE SYMBOL (LINK SYMBOL doesn't show up) */
+ color: grey;
+ margin-left: 0.2em;
+ text-decoration: none;
+}
/* Block Alignment */
/* Let content flow to the side of aligned images and figures */
Modified: trunk/docutils/test/data/help/docutils.rst
===================================================================
--- trunk/docutils/test/data/help/docutils.rst 2026-06-18 13:27:53 UTC (rev 10365)
+++ trunk/docutils/test/data/help/docutils.rst 2026-06-18 13:28:08 UTC (rev 10366)
@@ -201,9 +201,8 @@
--image-loading=<strategy>
Suggest at which point images should be loaded:
"embed", "link" (default), or "lazy".
---section-self-link Append a self-link to section headings.
+--section-self-link Append a self-link to section headings. (default)
--no-section-self-link Do not append a self-link to section headings.
- (default)
Docutils Application Options
----------------------------
Modified: trunk/docutils/test/functional/expected/rst_html5_tuftig.html
===================================================================
--- trunk/docutils/test/functional/expected/rst_html5_tuftig.html 2026-06-18 13:27:53 UTC (rev 10365)
+++ trunk/docutils/test/functional/expected/rst_html5_tuftig.html 2026-06-18 13:28:08 UTC (rev 10366)
@@ -29,7 +29,7 @@
</div>
</div>
<section id="fullwidth-and-margin-objects">
-<h2>Fullwidth and Margin Objects</h2>
+<h2>Fullwidth and Margin Objects<a class="self-link" title="link to this section" href="#fullwidth-and-margin-objects"></a></h2>
<p class="fullwidth">Block elements (paragraphs, admonitions, topics, figures, tables, …)
with the “fullwidth” class argument use full text width.</p>
<table class="booktabs numbered captionbelow fullwidth">
Modified: trunk/docutils/test/functional/expected/standalone_rst_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html5.html 2026-06-18 13:27:53 UTC (rev 10365)
+++ trunk/docutils/test/functional/expected/standalone_rst_html5.html 2026-06-18 13:28:08 UTC (rev 10366)
@@ -162,9 +162,9 @@
</ul>
</nav>
<section id="structural-elements">
-<h2><a class="toc-backref" href="#toc-entry-1" role="doc-backlink"><span class="sectnum">1 </span>Structural Elements</a></h2>
+<h2><a class="toc-backref" href="#toc-entry-1" role="doc-backlink"><span class="sectnum">1 </span>Structural Elements</a><a class="self-link" title="link to this section" href="#structural-elements"></a></h2>
<section id="section-title">
-<h3><a class="toc-backref" href="#toc-entry-2" role="doc-backlink"><span class="sectnum">1.1 </span>Section Title</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-2" role="doc-backlink"><span class="sectnum">1.1 </span>Section Title</a><a class="self-link" title="link to this section" href="#section-title"></a></h3>
<p class="section-subtitle" id="section-subtitle">Section Subtitle</p>
<p>Lone subsections are converted to a section subtitle by a transform
activated with the <span class="docutils literal"><span class="pre">--section-subtitles</span></span> command line option or the
@@ -171,10 +171,10 @@
<span class="docutils literal"><span class="pre">sectsubtitle-xform</span></span> configuration value.</p>
</section>
<section id="empty-section">
-<h3><a class="toc-backref" href="#toc-entry-3" role="doc-backlink"><span class="sectnum">1.2 </span>Empty Section</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-3" role="doc-backlink"><span class="sectnum">1.2 </span>Empty Section</a><a class="self-link" title="link to this section" href="#empty-section"></a></h3>
</section>
<section id="transitions">
-<h3><a class="toc-backref" href="#toc-entry-4" role="doc-backlink"><span class="sectnum">1.3 </span>Transitions</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-4" role="doc-backlink"><span class="sectnum">1.3 </span>Transitions</a><a class="self-link" title="link to this section" href="#transitions"></a></h3>
<p>Here's a transition:</p>
<hr class="docutils" />
<p>It divides the section. Transitions may also occur between sections:</p>
@@ -182,12 +182,12 @@
</section>
<hr class="docutils" />
<section id="body-elements">
-<h2><a class="toc-backref" href="#toc-entry-5" role="doc-backlink"><span class="sectnum">2 </span>Body Elements</a></h2>
+<h2><a class="toc-backref" href="#toc-entry-5" role="doc-backlink"><span class="sectnum">2 </span>Body Elements</a><a class="self-link" title="link to this section" href="#body-elements"></a></h2>
<section id="paragraphs">
-<h3><a class="toc-backref" href="#toc-entry-6" role="doc-backlink"><span class="sectnum">2.1 </span>Paragraphs</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-6" role="doc-backlink"><span class="sectnum">2.1 </span>Paragraphs</a><a class="self-link" title="link to this section" href="#paragraphs"></a></h3>
<p>A paragraph.</p>
<section id="inline-markup">
-<h4><a class="toc-backref" href="#toc-entry-7" role="doc-backlink"><span class="sectnum">2.1.1 </span>Inline Markup</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-7" role="doc-backlink"><span class="sectnum">2.1.1 </span>Inline Markup</a><a class="self-link" title="link to this section" href="#inline-markup"></a></h4>
<p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>,
<strong>strong emphasis</strong>, <span class="docutils literal">inline literals</span>, standalone hyperlinks
(<a class="reference external" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference external" href="http://www.python.org/">Python</a> <a class="brackets" href="#footnote-7" id="footnote-reference-18" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>), internal
@@ -216,7 +216,7 @@
</section>
</section>
<section id="bullet-lists">
-<h3><a class="toc-backref" href="#toc-entry-8" role="doc-backlink"><span class="sectnum">2.2 </span>Bullet Lists</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-8" role="doc-backlink"><span class="sectnum">2.2 </span>Bullet Lists</a><a class="self-link" title="link to this section" href="#bullet-lists"></a></h3>
<ul>
<li><p>A bullet list</p>
<ul class="simple">
@@ -243,7 +243,7 @@
</ul>
</section>
<section id="enumerated-lists">
-<h3><a class="toc-backref" href="#toc-entry-9" role="doc-backlink"><span class="sectnum">2.3 </span>Enumerated Lists</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-9" role="doc-backlink"><span class="sectnum">2.3 </span>Enumerated Lists</a><a class="self-link" title="link to this section" href="#enumerated-lists"></a></h3>
<ol class="arabic">
<li><p>Arabic numerals.</p>
<ol class="loweralpha simple">
@@ -279,7 +279,7 @@
</ol>
</section>
<section id="definition-lists">
-<h3><a class="toc-backref" href="#toc-entry-10" role="doc-backlink"><span class="sectnum">2.4 </span>Definition Lists</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-10" role="doc-backlink"><span class="sectnum">2.4 </span>Definition Lists</a><a class="self-link" title="link to this section" href="#definition-lists"></a></h3>
<dl>
<dt>Term</dt>
<dd><p>Definition</p>
@@ -297,7 +297,7 @@
</dl>
</section>
<section id="field-lists">
-<h3><a class="toc-backref" href="#toc-entry-11" role="doc-backlink"><span class="sectnum">2.5 </span>Field Lists</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-11" role="doc-backlink"><span class="sectnum">2.5 </span>Field Lists</a><a class="self-link" title="link to this section" href="#field-lists"></a></h3>
<dl class="field-list">
<dt>what<span class="colon">:</span></dt>
<dd><p>Field lists map field names to field bodies, like database
@@ -317,7 +317,7 @@
</dl>
</section>
<section id="option-lists">
-<h3><a class="toc-backref" href="#toc-entry-12" role="doc-backlink"><span class="sectnum">2.6 </span>Option Lists</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-12" role="doc-backlink"><span class="sectnum">2.6 </span>Option Lists</a><a class="self-link" title="link to this section" href="#option-lists"></a></h3>
<p>For listing command-line options:</p>
<dl class="option-list">
<dt><kbd><span class="option">-a</span></kbd></dt>
@@ -363,7 +363,7 @@
description.</p>
</section>
<section id="literal-blocks">
-<h3><a class="toc-backref" href="#toc-entry-13" role="doc-backlink"><span class="sectnum">2.7 </span>Literal Blocks</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-13" role="doc-backlink"><span class="sectnum">2.7 </span>Literal Blocks</a><a class="self-link" title="link to this section" href="#literal-blocks"></a></h3>
<p>Literal blocks are indicated with a double-colon ("::") at the end of
the preceding paragraph (over there <span class="docutils literal"><span class="pre">--></span></span>). They can be indented:</p>
<pre class="literal-block">if literal_block:
@@ -376,7 +376,7 @@
> Why didn't I think of that?</pre>
</section>
<section id="line-blocks">
-<h3><a class="toc-backref" href="#toc-entry-14" role="doc-backlink"><span class="sectnum">2.8 </span>Line Blocks</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-14" role="doc-backlink"><span class="sectnum">2.8 </span>Line Blocks</a><a class="self-link" title="link to this section" href="#line-blocks"></a></h3>
<p>This section tests line blocks. Line blocks are body elements which
consist of lines and other line blocks. Nested line blocks cause
indentation.</p>
@@ -450,7 +450,7 @@
</div>
</section>
<section id="block-quotes">
-<h3><a class="toc-backref" href="#toc-entry-15" role="doc-backlink"><span class="sectnum">2.9 </span>Block Quotes</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-15" role="doc-backlink"><span class="sectnum">2.9 </span>Block Quotes</a><a class="self-link" title="link to this section" href="#block-quotes"></a></h3>
<p>Block quotes consist of indented body elements:</p>
<blockquote>
<p>My theory by A. Elk. Brackets Miss, brackets. This theory goes
@@ -469,7 +469,7 @@
</blockquote>
</section>
<section id="doctest-blocks">
-<h3><a class="toc-backref" href="#toc-entry-16" role="doc-backlink"><span class="sectnum">2.10 </span>Doctest Blocks</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-16" role="doc-backlink"><span class="sectnum">2.10 </span>Doctest Blocks</a><a class="self-link" title="link to this section" href="#doctest-blocks"></a></h3>
<pre class="code python doctest">>>> print 'Python-specific usage examples; begun with ">>>"'
Python-specific usage examples; begun with ">>>"
>>> print '(cut and pasted from interactive Python sessions)'
@@ -477,7 +477,7 @@
</pre>
</section>
<section id="footnotes">
-<h3><a class="toc-backref" href="#toc-entry-17" role="doc-backlink"><span class="sectnum">2.11 </span>Footnotes</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-17" role="doc-backlink"><span class="sectnum">2.11 </span>Footnotes</a><a class="self-link" title="link to this section" href="#footnotes"></a></h3>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="footnote-1" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></span>
@@ -518,7 +518,7 @@
</aside>
</section>
<section id="citations">
-<h3><a class="toc-backref" href="#toc-entry-18" role="doc-backlink"><span class="sectnum">2.12 </span>Citations</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-18" role="doc-backlink"><span class="sectnum">2.12 </span>Citations</a><a class="self-link" title="link to this section" href="#citations"></a></h3>
<div role="list" class="citation-list">
<div class="citation" id="cit2002" role="doc-biblioentry">
<span class="label"><span class="fn-bracket">[</span>CIT2002<span class="fn-bracket">]</span></span>
@@ -531,7 +531,7 @@
citation.</p>
</section>
<section id="targets">
-<span id="another-target"></span><h3><a class="toc-backref" href="#toc-entry-19" role="doc-backlink"><span class="sectnum">2.13 </span>Targets</a></h3>
+<span id="another-target"></span><h3><a class="toc-backref" href="#toc-entry-19" role="doc-backlink"><span class="sectnum">2.13 </span>Targets</a><a class="self-link" title="link to this section" href="#another-target"></a></h3>
<p id="example">This paragraph is pointed to by the explicit "example" target. A
reference can be found under <a class="reference internal" href="#inline-markup">Inline Markup</a>, above. <a class="reference internal" href="#inline-hyperlink-targets">Inline
hyperlink targets</a> are also possible.</p>
@@ -544,13 +544,13 @@
<p>Here's a <a href="#system-message-4"><span class="problematic" id="problematic-2">`hyperlink reference without a target`_</span></a>, which generates an
error.</p>
<section id="duplicate-target-names-1">
-<h4><a class="toc-backref" href="#toc-entry-20" role="doc-backlink"><span class="sectnum">2.13.1 </span>Duplicate Target Names</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-20" role="doc-backlink"><span class="sectnum">2.13.1 </span>Duplicate Target Names</a><a class="self-link" title="link to this section" href="#duplicate-target-names-1"></a></h4>
<p>Duplicate names in section headers or other implicit targets will
generate "info" (level-1) system messages. Duplicate names in
explicit targets will generate "warning" (level-2) system messages.</p>
</section>
<section id="duplicate-target-names-2">
-<h4><a class="toc-backref" href="#toc-entry-21" role="doc-backlink"><span class="sectnum">2.13.2 </span>Duplicate Target Names</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-21" role="doc-backlink"><span class="sectnum">2.13.2 </span>Duplicate Target Names</a><a class="self-link" title="link to this section" href="#duplicate-target-names-2"></a></h4>
<p>Since there are two "Duplicate Target Names" section headers, we
cannot uniquely refer to either of them by name. If we try to (like
this: <a href="#system-message-5"><span class="problematic" id="problematic-3">`Duplicate Target Names`_</span></a>), an error is generated.</p>
@@ -557,7 +557,7 @@
</section>
</section>
<section id="directives">
-<h3><a class="toc-backref" href="#toc-entry-22" role="doc-backlink"><span class="sectnum">2.14 </span>Directives</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-22" role="doc-backlink"><span class="sectnum">2.14 </span>Directives</a><a class="self-link" title="link to this section" href="#directives"></a></h3>
<nav class="contents local" id="contents">
<ul class="auto-toc simple">
<li><p><a class="reference internal" href="#document-parts" id="toc-entry-55"><span class="sectnum">2.14.1 </span>Document Parts</a></p></li>
@@ -576,13 +576,13 @@
<p>These are just a sample of the many reStructuredText Directives. For
others, please see <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html">reStructuredText Directives</a> <a class="brackets" href="#footnote-15" id="footnote-reference-29" role="doc-noteref"><span class="fn-bracket">[</span>15<span class="fn-bracket">]</span></a>.</p>
<section id="document-parts">
-<h4><a class="toc-backref" href="#toc-entry-55" role="doc-backlink"><span class="sectnum">2.14.1 </span>Document Parts</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-55" role="doc-backlink"><span class="sectnum">2.14.1 </span>Document Parts</a><a class="self-link" title="link to this section" href="#document-parts"></a></h4>
<p>An example of the "contents" directive can be seen above this section
(a local, untitled table of <a class="reference internal" href="#contents">contents</a>) and at the beginning of the
document (a document-wide <a class="reference internal" href="#table-of-contents">table of contents</a>).</p>
</section>
<section id="images-and-figures">
-<h4><a class="toc-backref" href="#toc-entry-56" role="doc-backlink"><span class="sectnum">2.14.2 </span>Images and Figures</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-56" role="doc-backlink"><span class="sectnum">2.14.2 </span>Images and Figures</a><a class="self-link" title="link to this section" href="#images-and-figures"></a></h4>
<p>An image directive (also clickable -- a hyperlink reference):</p>
<a class="reference internal image-reference" href="#directives">
<img alt="../../../docs/user/rst/images/title.png" class="class1 class2" src="../../../docs/user/rst/images/title.png" style="width: 70%;" />
@@ -680,7 +680,7 @@
upon the style sheet and the browser or rendering software used.</p>
</section>
<section id="tables">
-<h4><a class="toc-backref" href="#toc-entry-57" role="doc-backlink"><span class="sectnum">2.14.3 </span>Tables</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-57" role="doc-backlink"><span class="sectnum">2.14.3 </span>Tables</a><a class="self-link" title="link to this section" href="#tables"></a></h4>
<p>Tables may be given titles and additional arguments with the <em>table</em>
directive:</p>
<table class="align-left">
@@ -762,7 +762,7 @@
</table>
</section>
<section id="admonitions">
-<h4><a class="toc-backref" href="#toc-entry-58" role="doc-backlink"><span class="sectnum">2.14.4 </span>Admonitions</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-58" role="doc-backlink"><span class="sectnum">2.14.4 </span>Admonitions</a><a class="self-link" title="link to this section" href="#admonitions"></a></h4>
<aside class="admonition attention">
<p class="admonition-title">Attention!</p>
<p>Directives at large.</p>
@@ -811,7 +811,7 @@
</aside>
</section>
<section id="topics-sidebars-and-rubrics">
-<h4><a class="toc-backref" href="#toc-entry-59" role="doc-backlink"><span class="sectnum">2.14.5 </span>Topics, Sidebars, and Rubrics</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-59" role="doc-backlink"><span class="sectnum">2.14.5 </span>Topics, Sidebars, and Rubrics</a><a class="self-link" title="link to this section" href="#topics-sidebars-and-rubrics"></a></h4>
<p><em>Sidebars</em> are like miniature, parallel documents.</p>
<aside class="sidebar">
<p class="sidebar-title">Optional Sidebar Title</p>
@@ -835,7 +835,7 @@
allowed (e.g. inside a directive).</p>
</section>
<section id="target-footnotes">
-<h4><a class="toc-backref" href="#toc-entry-60" role="doc-backlink"><span class="sectnum">2.14.6 </span>Target Footnotes</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-60" role="doc-backlink"><span class="sectnum">2.14.6 </span>Target Footnotes</a><a class="self-link" title="link to this section" href="#target-footnotes"></a></h4>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="footnote-7" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></span>
@@ -897,11 +897,11 @@
</aside>
</section>
<section id="replacement-text">
-<h4><a class="toc-backref" href="#toc-entry-61" role="doc-backlink"><span class="sectnum">2.14.7 </span>Replacement Text</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-61" role="doc-backlink"><span class="sectnum">2.14.7 </span>Replacement Text</a><a class="self-link" title="link to this section" href="#replacement-text"></a></h4>
<p>I recommend you try <a class="reference external" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="brackets" href="#footnote-7" id="footnote-reference-20" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a>.</p>
</section>
<section id="compound-paragraph">
-<h4><a class="toc-backref" href="#toc-entry-62" role="doc-backlink"><span class="sectnum">2.14.8 </span>Compound Paragraph</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-62" role="doc-backlink"><span class="sectnum">2.14.8 </span>Compound Paragraph</a><a class="self-link" title="link to this section" href="#compound-paragraph"></a></h4>
<p>The <em>compound</em> directive is used to create a "compound paragraph", which
is a single logical paragraph containing multiple physical body
elements. For example:</p>
@@ -1007,7 +1007,7 @@
</div>
</section>
<section id="parsed-literal-blocks">
-<h4><a class="toc-backref" href="#toc-entry-63" role="doc-backlink"><span class="sectnum">2.14.9 </span>Parsed Literal Blocks</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-63" role="doc-backlink"><span class="sectnum">2.14.9 </span>Parsed Literal Blocks</a><a class="self-link" title="link to this section" href="#parsed-literal-blocks"></a></h4>
<pre class="literal-block">This is a parsed literal block.
This line is indented. The next line is blank.
@@ -1026,7 +1026,7 @@
footnotes <a class="brackets" href="#footnote-1" id="footnote-reference-9" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, <span class="target" id="hyperlink-targets">hyperlink targets</span>, and <a class="reference external" href="http://www.python.org/">references</a>.</pre>
</section>
<section id="code">
-<h4><a class="toc-backref" href="#toc-entry-64" role="doc-backlink"><span class="sectnum">2.14.10 </span>Code</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-64" role="doc-backlink"><span class="sectnum">2.14.10 </span>Code</a><a class="self-link" title="link to this section" href="#code"></a></h4>
<p>Blocks of source code can be set with the <cite>code</cite> directive. If the code
language is specified, the content is parsed and tagged by the <a class="reference external" href="http://pygments.org/">Pygments</a> <a class="brackets" href="#footnote-8" id="footnote-reference-21" role="doc-noteref"><span class="fn-bracket">[</span>8<span class="fn-bracket">]</span></a>
syntax highlighter and can be formatted with a style sheet. (Code parsing
@@ -1058,19 +1058,19 @@
</code><small class="ln">2 </small><code data-lineno="2 ">.. footer:: Document footer</code></pre>
</section>
<section id="meta">
-<h4><a class="toc-backref" href="#toc-entry-65" role="doc-backlink"><span class="sectnum">2.14.11 </span>Meta</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-65" role="doc-backlink"><span class="sectnum">2.14.11 </span>Meta</a><a class="self-link" title="link to this section" href="#meta"></a></h4>
<p>The <a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata">“meta” directive</a> <a class="brackets" href="#footnote-16" id="footnote-reference-30" role="doc-noteref"><span class="fn-bracket">[</span>16<span class="fn-bracket">]</span></a> is used to specify metadata to be stored in,
e.g., HTML META tags or ODT file properties.</p>
</section>
</section>
<section id="substitution-definitions">
-<h3><a class="toc-backref" href="#toc-entry-34" role="doc-backlink"><span class="sectnum">2.15 </span>Substitution Definitions</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-34" role="doc-backlink"><span class="sectnum">2.15 </span>Substitution Definitions</a><a class="self-link" title="link to this section" href="#substitution-definitions"></a></h3>
<p>An inline image (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />) example:</p>
<p>A Unicode example:</p>
<p>(Substitution definitions are only visible in the rST source.)</p>
</section>
<section id="comments">
-<h3><a class="toc-backref" href="#toc-entry-35" role="doc-backlink"><span class="sectnum">2.16 </span>Comments</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-35" role="doc-backlink"><span class="sectnum">2.16 </span>Comments</a><a class="self-link" title="link to this section" href="#comments"></a></h3>
<p>Here's one:</p>
<!-- Comments begin with two dots and a space. Anything may
follow, except for the syntax of footnotes, hyperlink
@@ -1082,13 +1082,13 @@
<p>(View the HTML/LaTeX/... source to see the comment.)</p>
</section>
<section id="raw-text">
-<h3><a class="toc-backref" href="#toc-entry-36" role="doc-backlink"><span class="sectnum">2.17 </span>Raw text</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-36" role="doc-backlink"><span class="sectnum">2.17 </span>Raw text</a><a class="self-link" title="link to this section" href="#raw-text"></a></h3>
<p>This does not necessarily look nice, because there may be missing white space.</p>
<p>It's just there to freeze the behavior.</p>
A test.Second test.<div class="myclass">Another test with myclass set.</div><p>This is the <span class="myrawroleclass">fourth test</span> with myrawroleclass set.</p>
Fifth test in HTML.<br />Line two.</section>
<section id="container">
-<h3><a class="toc-backref" href="#toc-entry-37" role="doc-backlink"><span class="sectnum">2.18 </span>Container</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-37" role="doc-backlink"><span class="sectnum">2.18 </span>Container</a><a class="self-link" title="link to this section" href="#container"></a></h3>
<div class="custom docutils container">
<p>paragraph 1</p>
<p>paragraph 2</p>
@@ -1095,7 +1095,7 @@
</div>
</section>
<section id="colspanning-tables">
-<h3><a class="toc-backref" href="#toc-entry-38" role="doc-backlink"><span class="sectnum">2.19 </span>Colspanning tables</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-38" role="doc-backlink"><span class="sectnum">2.19 </span>Colspanning tables</a><a class="self-link" title="link to this section" href="#colspanning-tables"></a></h3>
<p>This table has a cell spanning two columns:</p>
<table>
<thead>
@@ -1128,7 +1128,7 @@
</table>
</section>
<section id="rowspanning-tables">
-<h3><a class="toc-backref" href="#toc-entry-39" role="doc-backlink"><span class="sectnum">2.20 </span>Rowspanning tables</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-39" role="doc-backlink"><span class="sectnum">2.20 </span>Rowspanning tables</a><a class="self-link" title="link to this section" href="#rowspanning-tables"></a></h3>
<p>Here's a table with cells spanning several rows:</p>
<table>
<thead>
@@ -1156,7 +1156,7 @@
</table>
</section>
<section id="complex-tables">
-<h3><a class="toc-backref" href="#toc-entry-40" role="doc-backlink"><span class="sectnum">2.21 </span>Complex tables</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-40" role="doc-backlink"><span class="sectnum">2.21 </span>Complex tables</a><a class="self-link" title="link to this section" href="#complex-tables"></a></h3>
<p>Here's a complex table, which should test all features.</p>
<table>
<thead>
@@ -1199,7 +1199,7 @@
</table>
</section>
<section id="list-tables">
-<h3><a class="toc-backref" href="#toc-entry-41" role="doc-backlink"><span class="sectnum">2.22 </span>List Tables</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-41" role="doc-backlink"><span class="sectnum">2.22 </span>List Tables</a><a class="self-link" title="link to this section" href="#list-tables"></a></h3>
<p>Here's a list table exercising all features:</p>
<table class="test" style="width: 95%;">
<caption>list table with integral header</caption>
@@ -1246,7 +1246,7 @@
</table>
</section>
<section id="custom-roles">
-<h3><a class="toc-backref" href="#toc-entry-42" role="doc-backlink"><span class="sectnum">2.23 </span>Custom Roles</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-42" role="doc-backlink"><span class="sectnum">2.23 </span>Custom Roles</a><a class="self-link" title="link to this section" href="#custom-roles"></a></h3>
<ul>
<li><p>A role based on an existing role.</p>
<p><span class="custom docutils literal">one</span> <span class="custom docutils literal">two</span> <span class="custom docutils literal">three</span></p>
@@ -1275,7 +1275,7 @@
</section>
</section>
<section id="differences-to-the-html4css1-writer">
-<h2><a class="toc-backref" href="#toc-entry-43" role="doc-backlink"><span class="sectnum">3 </span>Differences to the <cite>html4css1</cite> Writer</a></h2>
+<h2><a class="toc-backref" href="#toc-entry-43" role="doc-backlink"><span class="sectnum">3 </span>Differences to the <cite>html4css1</cite> Writer</a><a class="self-link" title="link to this section" href="#differences-to-the-html4css1-writer"></a></h2>
<ul>
<li><p>Use only <a class="reference internal" href="#meta">meta</a> keywords recognized by HTML 5.
Add HTML5-compatible meta tags for docinfo items
@@ -1313,7 +1313,7 @@
</li>
</ul>
<section id="field-list-rendering">
-<h3><a class="toc-backref" href="#toc-entry-44" role="doc-backlink"><span class="sectnum">3.1 </span>Field List Rendering</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-44" role="doc-backlink"><span class="sectnum">3.1 </span>Field List Rendering</a><a class="self-link" title="link to this section" href="#field-list-rendering"></a></h3>
<p>A <cite>field list</cite> is converted to a HTML <cite>definition list</cite> and given the
<span class="docutils literal"><span class="pre">field-list</span></span> class argument value to allow CSS styling.
With <span class="docutils literal">html_plain.css</span>, the layout is similar to <cite>html4css1</cite>:</p>
@@ -1337,11 +1337,11 @@
</dl>
</section>
<section id="styling-with-class-arguments">
-<h3><a class="toc-backref" href="#toc-entry-45" role="doc-backlink"><span class="sectnum">3.2 </span>Styling with Class Arguments</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-45" role="doc-backlink"><span class="sectnum">3.2 </span>Styling with Class Arguments</a><a class="self-link" title="link to this section" href="#styling-with-class-arguments"></a></h3>
<p>The <span class="docutils literal">plain.css</span> style sheet comes with some pre-defined style variants
that can be chosen via a class argument.</p>
<section id="description-lists">
-<h4><a class="toc-backref" href="#toc-entry-46" role="doc-backlink"><span class="sectnum">3.2.1 </span>Description Lists</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-46" role="doc-backlink"><span class="sectnum">3.2.1 </span>Description Lists</a><a class="self-link" title="link to this section" href="#description-lists"></a></h4>
<p>Definition lists with the "description" class argument:</p>
<dl class="description">
<dt>description lists</dt>
@@ -1380,7 +1380,7 @@
</dl>
</section>
<section id="details-disclosure-elements">
-<h4><a class="toc-backref" href="#toc-entry-47" role="doc-backlink"><span class="sectnum">3.2.2 </span>Details disclosure elements</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-47" role="doc-backlink"><span class="sectnum">3.2.2 </span>Details disclosure elements</a><a class="self-link" title="link to this section" href="#details-disclosure-elements"></a></h4>
<p>Items of <a class="reference internal" href="#definition-lists">definition lists</a> with class argument "details" are converted
to <a class="reference external" href="https://www.w3.org/TR/html52/interactive-elements.html#the-details-element">details</a> <a class="brackets" href="#footnote-10" id="footnote-reference-23" role="doc-noteref"><span class="fn-bracket">[</span>10<span class="fn-bracket">]</span></a> disclosure elements with the term becoming the "summary".</p>
<div class="details" id="closed-details">
@@ -1398,7 +1398,7 @@
</div>
</section>
<section id="field-list-variants">
-<h4><a class="toc-backref" href="#toc-entry-48" role="doc-backlink"><span class="sectnum">3.2.3 </span>Field List Variants</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-48" role="doc-backlink"><span class="sectnum">3.2.3 </span>Field List Variants</a><a class="self-link" title="link to this section" href="#field-list-variants"></a></h4>
<p>For field lists, the "compact/open", "narrow" and "run-in" styles are defined
in the style sheets <span class="docutils literal">plain.css</span> and <span class="docutils literal">responsive.css</span>.</p>
<dl class="simple">
@@ -1479,7 +1479,7 @@
</dl>
</section>
<section id="table-variants">
-<h4><a class="toc-backref" href="#toc-entry-49" role="doc-backlink"><span class="sectnum">3.2.4 </span>Table Variants</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-49" role="doc-backlink"><span class="sectnum">3.2.4 </span>Table Variants</a><a class="self-link" title="link to this section" href="#table-variants"></a></h4>
<p>The following styles can be applied to individual tables via a class
argument or as document wide setting with the <a class="reference external" href="https://docutils.sourceforge.io/docs/user/config.html#table-style">table-style</a> <a class="brackets" href="#footnote-11" id="footnote-reference-24" role="doc-noteref"><span class="fn-bracket">[</span>11<span class="fn-bracket">]</span></a> configuration
setting (or command line argument).</p>
@@ -1554,7 +1554,7 @@
</blockquote>
</section>
<section id="numbered-figures">
-<h4><a class="toc-backref" href="#toc-entry-50" role="doc-backlink"><span class="sectnum">3.2.5 </span>Numbered Figures</a></h4>
+<h4><a class="toc-backref" href="#toc-entry-50" role="doc-backlink"><span class="sectnum">3.2.5 </span>Numbered Figures</a><a class="self-link" title="link to this section" href="#numbered-figures"></a></h4>
<p>Numbered figures can be achieved with the "numbered" <span class="docutils literal">:figclass:</span> option:</p>
<figure class="numbered">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 240 32" style="width: 100%;">
@@ -1567,7 +1567,7 @@
</section>
</section>
<section id="text-level-semantics">
-<h3><a class="toc-backref" href="#toc-entry-51" role="doc-backlink"><span class="sectnum">3.3 </span>Text-Level Semantics</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-51" role="doc-backlink"><span class="sectnum">3.3 </span>Text-Level Semantics</a><a class="self-link" title="link to this section" href="#text-level-semantics"></a></h3>
<p>This section describes the <a class="reference external" href="https://html.spec.whatwg.org/#text-level-semantics">HTML 5 tags for representation of text-level
semantics</a> <a class="brackets" href="#footnote-19" id="footnote-reference-33" role="doc-noteref"><span class="fn-bracket">[</span>19<span class="fn-bracket">]</span></a> and their reStructuredText equivalents.</p>
<dl class="description">
@@ -1779,7 +1779,7 @@
</aside>
</section>
<section id="indicating-edits">
-<h3><a class="toc-backref" href="#toc-entry-52" role="doc-backlink"><span class="sectnum">3.4 </span>Indicating Edits</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-52" role="doc-backlink"><span class="sectnum">3.4 </span>Indicating Edits</a><a class="self-link" title="link to this section" href="#indicating-edits"></a></h3>
<p>The <a class="reference external" href="https://html.spec.whatwg.org/multipage/edits.html">HTML tags for representation of edits to the document</a> <a class="brackets" href="#footnote-20" id="footnote-reference-34" role="doc-noteref"><span class="fn-bracket">[</span>20<span class="fn-bracket">]</span></a> and their
reStructuredText equivalents are:</p>
<dl class="description">
@@ -1804,7 +1804,7 @@
</dl>
</section>
<section id="svg-images">
-<h3><a class="toc-backref" href="#toc-entry-53" role="doc-backlink"><span class="sectnum">3.5 </span>SVG Images</a></h3>
+<h3><a class="toc-backref" href="#toc-entry-53" role="doc-backlink"><span class="sectnum">3.5 </span>SVG Images</a><a class="self-link" title="link to this section" href="#svg-images"></a></h3>
<img alt="../../../docs/user/rst/images/biohazard.svg" class="align-left" src="../../../docs/user/rst/images/biohazard.svg" style="width: 48px; height: 48px;" />
<p>Scalable vector graphics (SVG) images are the only standards-compatible
way to include vector graphics in HTML documents. However, they are not
@@ -1901,7 +1901,7 @@
</section>
</section>
<section id="error-handling">
-<h2><a class="toc-backref" href="#toc-entry-54" role="doc-backlink"><span class="sectnum">4 </span>Error Handling</a></h2>
+<h2><a class="toc-backref" href="#toc-entry-54" role="doc-backlink"><span class="sectnum">4 </span>Error Handling</a><a class="self-link" title="link to this section" href="#error-handling"></a></h2>
<p>Any errors caught during processing will generate system messages.</p>
<p>There should be five messages in the following, auto-generated
section, "Docutils System Messages":</p>
Modified: trunk/docutils/test/functional/tests/length_units_html5.py
===================================================================
--- trunk/docutils/test/functional/tests/length_units_html5.py 2026-06-18 13:27:53 UTC (rev 10365)
+++ trunk/docutils/test/functional/tests/length_units_html5.py 2026-06-18 13:28:08 UTC (rev 10366)
@@ -15,4 +15,5 @@
settings_overrides = {
# location of stylesheets (relative to ``docutils/test/``)
'stylesheet_dirs': ('functional/input/data', ),
+ 'section_self_link': False,
}
Modified: trunk/docutils/test/test_writers/test_html5_template.py
===================================================================
--- trunk/docutils/test/test_writers/test_html5_template.py 2026-06-18 13:27:53 UTC (rev 10365)
+++ trunk/docutils/test/test_writers/test_html5_template.py 2026-06-18 13:28:08 UTC (rev 10366)
@@ -43,7 +43,8 @@
'template': template_path,
'stylesheet_path': '/test.css',
'embed_stylesheet': False,
- }).decode()
+ 'section_self_link': False,
+ }).decode()
self.assertEqual(case_expected, output)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|