1# Configuration file for the Sphinx documentation builder. 2# 3# For the full list of built-in configuration values, see the documentation: 4# https://www.sphinx-doc.org/en/master/usage/configuration.html 5 6import os.path 7import sys 8 9from docutils.nodes import Element 10from sphinx.writers.html5 import HTML5Translator 11 12sys.path.insert(0, os.path.abspath('.')) 13 14# -- Project information ----------------------------------------------------- 15# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information 16 17project = 'typing_extensions' 18copyright = '2023, Guido van Rossum and others' 19author = 'Guido van Rossum and others' 20release = '4.6.0' 21 22# -- General configuration --------------------------------------------------- 23# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration 24 25extensions = ['sphinx.ext.intersphinx', '_extensions.gh_link'] 26 27templates_path = ['_templates'] 28exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] 29 30intersphinx_mapping = {'py': ('https://docs.python.org/3.12', None)} 31 32add_module_names = False 33 34# -- Options for HTML output ------------------------------------------------- 35# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output 36 37html_theme = 'alabaster' 38 39 40class MyTranslator(HTML5Translator): 41 """Adds a link target to name without `typing_extensions.` prefix.""" 42 def visit_desc_signature(self, node: Element) -> None: 43 desc_name = node.get("fullname") 44 if desc_name: 45 self.body.append(f'<span id="{desc_name}"></span>') 46 super().visit_desc_signature(node) 47 48 49def setup(app): 50 app.set_translator('html', MyTranslator) 51