Skip to content
Myr

conf.py

This file

Path

docs/conf.py

96 lines · 3.2 KiB · Python

Last changed by

Merge pull request #5073 from pallets/new-logoDavid Lordbefore adoption2b2a764

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]23autodoc_typehints = "description"24intersphinx_mapping = {25    "python": ("https://docs.python.org/3/", None),26    "werkzeug": ("https://werkzeug.palletsprojects.com/", None),27    "click": ("https://click.palletsprojects.com/", None),28    "jinja": ("https://jinja.palletsprojects.com/", None),29    "itsdangerous": ("https://itsdangerous.palletsprojects.com/", None),30    "sqlalchemy": ("https://docs.sqlalchemy.org/", None),31    "wtforms": ("https://wtforms.readthedocs.io/", None),32    "blinker": ("https://blinker.readthedocs.io/", None),33}34issues_github_path = "pallets/flask"3536# HTML -----------------------------------------------------------------3738html_theme = "flask"39html_theme_options = {"index_sidebar_logo": False}40html_context = {41    "project_links": [42        ProjectLink("Donate", "https://palletsprojects.com/donate"),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        ProjectLink("Chat", "https://discord.gg/pallets"),47    ]48}49html_sidebars = {50    "index": ["project.html", "localtoc.html", "searchbox.html", "ethicalads.html"],51    "**": ["localtoc.html", "relations.html", "searchbox.html", "ethicalads.html"],52}53singlehtml_sidebars = {"index": ["project.html", "localtoc.html", "ethicalads.html"]}54html_static_path = ["_static"]55html_favicon = "_static/shortcut-icon.png"56html_logo = "_static/flask-vertical.png"57html_title = f"Flask Documentation ({version})"58html_show_sourcelink = False5960# LaTeX ----------------------------------------------------------------6162latex_documents = [(master_doc, f"Flask-{version}.tex", html_title, author, "manual")]6364# Local Extensions -----------------------------------------------------656667def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):68    app = inliner.document.settings.env.app69    release = app.config.release70    base_url = "https://github.com/pallets/flask/tree/"7172    if text.endswith(">"):73        words, text = text[:-1].rsplit("<", 1)74        words = words.strip()75    else:76        words = None7778    if packaging.version.parse(release).is_devrelease:79        url = f"{base_url}main/{text}"80    else:81        url = f"{base_url}{release}/{text}"8283    if words is None:84        words = url8586    from docutils.nodes import reference87    from docutils.parsers.rst.roles import set_classes8889    options = options or {}90    set_classes(options)91    node = reference(rawtext, words, refuri=url, **options)92    return [node], []939495def setup(app):96    app.add_role("gh", github_link)