Skip to content
Myr

conf.py

This file

Path

docs/conf.py

97 lines · 3.2 KiB · Python

Last changed by

Merge branch '3.0.x'David Lordbefore adoption6ab71ed

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}30intersphinx_mapping = {31    "python": ("https://docs.python.org/3/", None),32    "werkzeug": ("https://werkzeug.palletsprojects.com/", None),33    "click": ("https://click.palletsprojects.com/", None),34    "jinja": ("https://jinja.palletsprojects.com/", None),35    "itsdangerous": ("https://itsdangerous.palletsprojects.com/", None),36    "sqlalchemy": ("https://docs.sqlalchemy.org/", None),37    "wtforms": ("https://wtforms.readthedocs.io/", None),38    "blinker": ("https://blinker.readthedocs.io/", None),39}4041# HTML -----------------------------------------------------------------4243html_theme = "flask"44html_theme_options = {"index_sidebar_logo": False}45html_context = {46    "project_links": [47        ProjectLink("Donate", "https://palletsprojects.com/donate"),48        ProjectLink("PyPI Releases", "https://pypi.org/project/Flask/"),49        ProjectLink("Source Code", "https://github.com/pallets/flask/"),50        ProjectLink("Issue Tracker", "https://github.com/pallets/flask/issues/"),51        ProjectLink("Chat", "https://discord.gg/pallets"),52    ]53}54html_sidebars = {55    "index": ["project.html", "localtoc.html", "searchbox.html", "ethicalads.html"],56    "**": ["localtoc.html", "relations.html", "searchbox.html", "ethicalads.html"],57}58singlehtml_sidebars = {"index": ["project.html", "localtoc.html", "ethicalads.html"]}59html_static_path = ["_static"]60html_favicon = "_static/shortcut-icon.png"61html_logo = "_static/flask-vertical.png"62html_title = f"Flask Documentation ({version})"63html_show_sourcelink = False6465# Local Extensions -----------------------------------------------------666768def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):69    app = inliner.document.settings.env.app70    release = app.config.release71    base_url = "https://github.com/pallets/flask/tree/"7273    if text.endswith(">"):74        words, text = text[:-1].rsplit("<", 1)75        words = words.strip()76    else:77        words = None7879    if packaging.version.parse(release).is_devrelease:80        url = f"{base_url}main/{text}"81    else:82        url = f"{base_url}{release}/{text}"8384    if words is None:85        words = url8687    from docutils.nodes import reference88    from docutils.parsers.rst.roles import set_classes8990    options = options or {}91    set_classes(options)92    node = reference(rawtext, words, refuri=url, **options)93    return [node], []949596def setup(app):97    app.add_role("gh", github_link)