mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add configuration option html_signaturereturn_icon for the arrow before a return type hint.
This commit is contained in:
parent
cf2d5b3f32
commit
b079543405
@ -1191,6 +1191,11 @@ that use Sphinx's HTMLWriter class.
|
||||
|
||||
.. versionadded:: 3.5
|
||||
|
||||
.. confval:: html_signaturereturn_icon
|
||||
|
||||
A text for prepended to the type hint for the return type of a function or
|
||||
method. HTML tags are allowed. Default: an wrrow; ``→``
|
||||
|
||||
.. confval:: html_sidebars
|
||||
|
||||
Custom sidebar templates, must be a dictionary that maps document names to
|
||||
|
@ -1320,6 +1320,7 @@ def setup(app: Sphinx) -> Dict[str, Any]:
|
||||
app.add_config_value('html_add_permalinks', UNSET, 'html')
|
||||
app.add_config_value('html_permalinks', True, 'html')
|
||||
app.add_config_value('html_permalinks_icon', '¶', 'html')
|
||||
app.add_config_value('html_signaturereturn_icon', '→', 'html')
|
||||
app.add_config_value('html_use_index', True, 'html')
|
||||
app.add_config_value('html_split_index', False, 'html')
|
||||
app.add_config_value('html_copy_source', True, 'html')
|
||||
|
@ -174,7 +174,9 @@ class HTMLTranslator(SphinxTranslator, BaseTranslator):
|
||||
pass
|
||||
|
||||
def visit_desc_returns(self, node: Element) -> None:
|
||||
self.body.append(' <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint">')
|
||||
self.body.append(' <span class="sig-return"><span class="sig-return-icon">')
|
||||
self.body.append(self.config.html_signaturereturn_icon)
|
||||
self.body.append('</span> <span class="sig-return-typehint">')
|
||||
|
||||
def depart_desc_returns(self, node: Element) -> None:
|
||||
self.body.append('</span></span>')
|
||||
|
@ -145,7 +145,9 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
|
||||
pass
|
||||
|
||||
def visit_desc_returns(self, node: Element) -> None:
|
||||
self.body.append(' <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint">')
|
||||
self.body.append(' <span class="sig-return"><span class="sig-return-icon">')
|
||||
self.body.append(self.config.html_signaturereturn_icon)
|
||||
self.body.append('</span> <span class="sig-return-typehint">')
|
||||
|
||||
def depart_desc_returns(self, node: Element) -> None:
|
||||
self.body.append('</span></span>')
|
||||
|
Loading…
Reference in New Issue
Block a user