1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # Set up Python environment to load build system packages.
9 OUR_DIR
= os
.path
.dirname(__file__
)
10 topsrcdir
= os
.path
.normpath(os
.path
.join(OUR_DIR
, ".."))
12 # Escapes $, [, ] and 3 dots in copy button
13 copybutton_prompt_text
= r
">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
14 copybutton_prompt_is_regexp
= True
17 "layout/tools/reftest",
20 "python/mozversioncontrol",
21 "testing/mozbase/manifestparser",
22 "testing/mozbase/mozfile",
23 "testing/mozbase/mozprocess",
24 "third_party/python/jsmin",
25 "third_party/python/which",
29 sys
.path
[:0] = [os
.path
.join(topsrcdir
, p
) for p
in EXTRA_PATHS
]
31 sys
.path
.insert(0, OUR_DIR
)
36 "sphinx.ext.autosectionlabel",
38 "sphinx.ext.graphviz",
39 "sphinx.ext.napoleon",
43 "sphinxcontrib.mermaid",
45 "sphinx_markdown_tables",
50 # JSDoc must run successfully for dirs specified, so running
51 # tree-wide (the default) will not work currently.
53 "../browser/components/extensions",
54 "../browser/components/migration",
55 "../browser/components/migration/content",
56 "../browser/components/uitour",
57 "../browser/components/urlbar",
58 "../remote/marionette",
59 "../testing/mochitest/BrowserTestUtils",
60 "../testing/mochitest/tests/SimpleTest/SimpleTest.js",
61 "../testing/mochitest/tests/SimpleTest/EventUtils.js",
62 "../testing/modules/Assert.sys.mjs",
63 "../testing/modules/TestUtils.sys.mjs",
65 "../toolkit/components/extensions",
66 "../toolkit/components/extensions/parent",
67 "../toolkit/components/featuregates",
68 "../toolkit/mozapps/extensions",
69 "../toolkit/components/prompts/src",
70 "../toolkit/components/pictureinpicture",
71 "../toolkit/components/pictureinpicture/content",
73 root_for_relative_js_paths
= ".."
74 jsdoc_config_path
= "jsdoc.json"
76 templates_path
= ["_templates"]
77 source_suffix
= [".rst", ".md"]
79 project
= "Firefox Source Docs"
81 # Override the search box to use Google instead of
82 # sphinx search on firefox-source-docs.mozilla.org
84 os
.environ
.get("MOZ_SOURCE_DOCS_USE_GOOGLE") == "1"
85 and os
.environ
.get("MOZ_SCM_LEVEL") == "3"
87 templates_path
.append("_search_template")
94 html_logo
= os
.path
.join(
95 topsrcdir
, "browser/branding/nightly/content/firefox-wordmark.svg"
97 html_favicon
= os
.path
.join(topsrcdir
, "browser/branding/nightly/firefox.ico")
98 html_js_files
= ["https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.9.1/mermaid.js"]
100 exclude_patterns
= ["_build", "_staging", "_venv"]
101 pygments_style
= "sphinx"
103 # We need to perform some adjustment of the settings and environment
104 # when running on Read The Docs.
105 on_rtd
= os
.environ
.get("READTHEDOCS", None) == "True"
108 # SHELL isn't set on RTD and mach.mixin.process's import raises if a
109 # shell-related environment variable can't be found. Set the variable here
110 # to hack us into working on RTD.
111 assert "SHELL" not in os
.environ
112 os
.environ
["SHELL"] = "/bin/bash"
114 # We only need to set the RTD theme when not on RTD because the RTD
115 # environment handles this otherwise.
116 import sphinx_rtd_theme
118 html_theme
= "sphinx_rtd_theme"
119 html_theme_path
= [sphinx_rtd_theme
.get_html_theme_path()]
122 html_static_path
= ["_static"]
123 htmlhelp_basename
= "FirefoxTreeDocs"
125 moz_project_name
= "main"
127 html_show_copyright
= False
129 # Only run autosection for the page title.
130 # Otherwise, we have a huge number of duplicate links.
131 # For example, the page https://firefox-source-docs.mozilla.org/code-quality/lint/
132 # is called "Linting"
133 # just like https://firefox-source-docs.mozilla.org/remote/CodeStyle.html
134 autosectionlabel_maxdepth
= 1
137 def install_sphinx_panels(app
, pagename
, templatename
, context
, doctree
):
138 if "perfdocs" in pagename
:
139 app
.add_js_file("sphinx_panels.js")
140 app
.add_css_file("sphinx_panels.css")
144 app
.add_css_file("custom_theme.css")
145 app
.connect("html-page-context", install_sphinx_panels
)