Debian Codegraph @

docs/source/conf.py

raw
1 """Sphinx configuration file for sphinx-favicon documentation."""
2
3 # -- imports and read config ---------------------------------------------------
4 import datetime as dt
5 from importlib import metadata
6
7 try:
8 release_version = metadata.version("sphinx-favicon")
9 except metadata.PackageNotFoundError:
10 release_version = "unknown-dev"
11 year = dt.datetime.now().year
12
13 # -- Project information -------------------------------------------------------
14 project = "Sphinx Favicon"
15 copyright = f"{year}, Timo Metzger"
16 author = "Timo Metzger"
17 release = release_version
18
19 # -- General configuration -----------------------------------------------------
20 extensions = [
21 "sphinx.ext.autosectionlabel",
22 "sphinx_favicon",
23 "sphinx_copybutton",
24 "sphinx_design",
25 ]
26 source_suffix = [".rst", ".md"]
27 templates_path = ["_templates"]
28 exclude_patterns = ["Thumbs.db", ".DS_Store", "**.ipynb_checkpoints"]
29
30 # -- Options for HTML output ---------------------------------------------------
31 html_theme = "pydata_sphinx_theme"
32 html_static_path = ["_static"]
33 html_css_files = ["custom.css"]
34 html_context = {
35 "display_github": True,
36 "github_user": "tcmetzger",
37 "github_repo": "sphinx-favicon",
38 "github_version": "main/docs/source/",
39 }
40
41 # -- Options for the html theme ------------------------------------------------
42 html_theme_options = {
43 "icon_links": [
44 {
45 "name": "GitHub",
46 "url": "https://github.com/tcmetzger/sphinx-favicon",
47 "icon": "fa-brands fa-github",
48 },
49 {
50 "name": "PyPi",
51 "url": "https://pypi.org/project/sphinx-favicon/",
52 "icon": "fa-brands fa-python",
53 },
54 ],
55 "logo": {"text": project},
56 "use_edit_page_button": True,
57 "announcement": (
58 "<p>Between v0.2 and v1.0, the module name of the extension changed to better "
59 "conform with Python standards. Please update the name used in the extension "
60 'list of your <code class="docutils literal notranslate"><span class="pre">'
61 'conf.py</span></code> from <code class="docutils literal notranslate">'
62 '<span class="pre">sphinx-favicon</span></code> to '
63 '<code class="docutils literal notranslate"><span class="pre">'
64 "sphinx_favicon</span></code>!</p>"
65 ),
66 }
67
68 # -- Option for favicons -------------------------------------------------------
69 favicons = [
70 # generic icons compatible with most browsers
71 {"href": "favicon-32x32.png"},
72 "favicon-16x16.png",
73 {"rel": "shortcut icon", "sizes": "any", "href": "favicon.ico"},
74 # chrome specific
75 "android-chrome-192x192.png",
76 # apple icons
77 {"rel": "mask-icon", "color": "#2d89ef", "href": "safari-pinned-tab.svg"},
78 {"rel": "apple-touch-icon", "href": "apple-touch-icon.png"},
79 # msapplications
80 {"name": "msapplication-TileColor", "content": "#2d89ef"},
81 {"name": "theme-color", "content": "#ffffff"},
82 "https://raw.githubusercontent.com/tcmetzger/sphinx-favicon/main/docs/source/_static/mstile-150x150.png"
83 # to show it works as well with absolute urls
84 ]