Skip to content
Myr

conf.py

This file

Path

docs/conf.py

101 lines · 3.3 KiB · Python

Last changed by

Merge branch 'stable'David Lordbefore adoption85c5d93

History of this file

Take it

1import packaging.version2from pallets_sphinx_themes import get_version3from pallets_sphinx_themes import ProjectLink45# Project --------------------------------------------------------------67project = "Flask"8copyright = "2010 Pallets"9author = "Pallets"10release, version = get_version("Flask")1112# General --------------------------------------------------------------1314default_role = "code"15extensions = [16    "sphinx.ext.autodoc",17    "sphinx.ext.extlinks",18    "sphinx.ext.intersphinx",19    "sphinxcontrib.log_cabinet",20    "sphinx_tabs.tabs",21    "pallets_sphinx_themes",22]23autodoc_member_order = "bysource"24autodoc_typehints = "description"25autodoc_preserve_defaults = True26extlinks = {27    "issue": ("https://github.com/pallets/flask/issues/%s", "#%s"),28    "pr": ("https://github.com/pallets/flask/pull/%s", "#%s"),29    "ghsa": ("https://github.com/pallets/flask/security/advisories/GHSA-%s", "GHSA-%s"),30}31intersphinx_mapping = {32    "python": ("https://docs.python.org/3/", None),33    "werkzeug": ("https://werkzeug.palletsprojects.com/", None),34    "click": ("https://click.palletsprojects.com/", None),35    "jinja": ("https://jinja.palletsprojects.com/", None),36    "itsdangerous": ("https://itsdangerous.palletsprojects.com/", None),37    "sqlalchemy": ("https://docs.sqlalchemy.org/", None),38    "wtforms": ("https://wtforms.readthedocs.io/", None),39    "blinker": ("https://blinker.readthedocs.io/", None),40}4142# HTML -----------------------------------------------------------------4344html_theme = "flask"45html_theme_options = {"index_sidebar_logo": False}46html_context = {47    "project_links": [48        ProjectLink("Donate", "https://palletsprojects.com/donate"),49        ProjectLink("PyPI Releases", "https://pypi.org/project/Flask/"),50        ProjectLink("Source Code", "https://github.com/pallets/flask/"),51        ProjectLink("Issue Tracker", "https://github.com/pallets/flask/issues/"),52        ProjectLink("Chat", "https://discord.gg/pallets"),53    ]54}55html_sidebars = {56    "index": ["project.html", "localtoc.html", "searchbox.html", "ethicalads.html"],57    "**": ["localtoc.html", "relations.html", "searchbox.html", "ethicalads.html"],58}59singlehtml_sidebars = {"index": ["project.html", "localtoc.html", "ethicalads.html"]}60html_static_path = ["_static"]61html_favicon = "_static/flask-icon.svg"62html_logo = "_static/flask-logo.svg"63html_title = f"Flask Documentation ({version})"64html_show_sourcelink = False6566gettext_uuid = True67gettext_compact = False6869# Local Extensions -----------------------------------------------------707172def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):73    app = inliner.document.settings.env.app74    release = app.config.release75    base_url = "https://github.com/pallets/flask/tree/"7677    if text.endswith(">"):78        words, text = text[:-1].rsplit("<", 1)79        words = words.strip()80    else:81        words = None8283    if packaging.version.parse(release).is_devrelease:84        url = f"{base_url}main/{text}"85    else:86        url = f"{base_url}{release}/{text}"8788    if words is None:89        words = url9091    from docutils.nodes import reference92    from docutils.parsers.rst.roles import set_classes9394    options = options or {}95    set_classes(options)96    node = reference(rawtext, words, refuri=url, **options)97    return [node], []9899100def setup(app):101    app.add_role("gh", github_link)