Skip to content
Myr

conf.py

This file

Path

docs/conf.py

95 lines · 3.1 KiB · Python

Last changed by

Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc

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 --------------------------------------------------------------1314master_doc = "index"15extensions = [16    "sphinx.ext.autodoc",17    "sphinx.ext.intersphinx",18    "sphinxcontrib.log_cabinet",19    "pallets_sphinx_themes",20    "sphinx_issues",21    "sphinx_tabs.tabs",22]23intersphinx_mapping = {24    "python": ("https://docs.python.org/3/", None),25    "werkzeug": ("https://werkzeug.palletsprojects.com/", None),26    "click": ("https://click.palletsprojects.com/", None),27    "jinja": ("https://jinja.palletsprojects.com/", None),28    "itsdangerous": ("https://itsdangerous.palletsprojects.com/", None),29    "sqlalchemy": ("https://docs.sqlalchemy.org/", None),30    "wtforms": ("https://wtforms.readthedocs.io/", None),31    "blinker": ("https://pythonhosted.org/blinker/", None),32}33issues_github_path = "pallets/flask"3435# HTML -----------------------------------------------------------------3637html_theme = "flask"38html_theme_options = {"index_sidebar_logo": False}39html_context = {40    "project_links": [41        ProjectLink("Donate to Pallets", "https://palletsprojects.com/donate"),42        ProjectLink("Flask Website", "https://palletsprojects.com/p/flask/"),43        ProjectLink("PyPI releases", "https://pypi.org/project/Flask/"),44        ProjectLink("Source Code", "https://github.com/pallets/flask/"),45        ProjectLink("Issue Tracker", "https://github.com/pallets/flask/issues/"),46    ]47}48html_sidebars = {49    "index": ["project.html", "localtoc.html", "searchbox.html"],50    "**": ["localtoc.html", "relations.html", "searchbox.html"],51}52singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]}53html_static_path = ["_static"]54html_favicon = "_static/flask-icon.png"55html_logo = "_static/flask-icon.png"56html_title = f"Flask Documentation ({version})"57html_show_sourcelink = False5859# LaTeX ----------------------------------------------------------------6061latex_documents = [(master_doc, f"Flask-{version}.tex", html_title, author, "manual")]6263# Local Extensions -----------------------------------------------------646566def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):67    app = inliner.document.settings.env.app68    release = app.config.release69    base_url = "https://github.com/pallets/flask/tree/"7071    if text.endswith(">"):72        words, text = text[:-1].rsplit("<", 1)73        words = words.strip()74    else:75        words = None7677    if packaging.version.parse(release).is_devrelease:78        url = f"{base_url}master/{text}"79    else:80        url = f"{base_url}{release}/{text}"8182    if words is None:83        words = url8485    from docutils.nodes import reference86    from docutils.parsers.rst.roles import set_classes8788    options = options or {}89    set_classes(options)90    node = reference(rawtext, words, refuri=url, **options)91    return [node], []929394def setup(app):95    app.add_role("gh", github_link)