Close #6550: html: Allow to use HTML permalink texts

Add new configuration variables: `html_permalinks` and
`html_permalinks_icon`.

This refines the settings around HTML permalinks.

* html_add_permalinks
  * Deprecated.
* html_permalinks
  * Enable or disable permalinks feature.
* html_permalinks_icon
  * Change the icon for permalinks
This commit is contained in:
Takeshi KOMIYA
2020-12-27 15:25:22 +09:00
parent 3a0a6556c5
commit 15cbc6dbb0
7 changed files with 92 additions and 23 deletions

View File

@@ -1665,3 +1665,23 @@ def test_highlight_options_old(app):
location=ANY, opts={})
assert call_args[2] == call(ANY, 'java', force=False, linenos=False,
location=ANY, opts={})
@pytest.mark.sphinx('html', testroot='basic',
confoverrides={'html_permalinks': False})
def test_html_permalink_disable(app):
app.build()
content = (app.outdir / 'index.html').read_text()
assert '<h1>The basic Sphinx documentation for testing</h1>' in content
@pytest.mark.sphinx('html', testroot='basic',
confoverrides={'html_permalinks_icon': '<span>[PERMALINK]</span>'})
def test_html_permalink_icon(app):
app.build()
content = (app.outdir / 'index.html').read_text()
assert ('<h1>The basic Sphinx documentation for testing<a class="headerlink" '
'href="#the-basic-sphinx-documentation-for-testing" '
'title="Permalink to this headline"><span>[PERMALINK]</span></a></h1>' in content)