Bug 1702346 [wpt PR 28323] - Fix typo in preserve-3d test, a=testonly
[gecko.git] / docs / conf.py
blob4a5ca8069ec428bdb0cc25a61e27338aff3f1938
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/.
5 from __future__ import absolute_import, unicode_literals
7 import os
8 import sys
10 from recommonmark.transform import AutoStructify
12 # Set up Python environment to load build system packages.
13 OUR_DIR = os.path.dirname(__file__)
14 topsrcdir = os.path.normpath(os.path.join(OUR_DIR, ".."))
16 # Escapes $, [, ] and 3 dots in copy button
17 copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
18 copybutton_prompt_is_regexp = True
20 EXTRA_PATHS = (
21 "layout/tools/reftest",
22 "python/mach",
23 "python/mozbuild",
24 "python/mozversioncontrol",
25 "testing/mozbase/manifestparser",
26 "testing/mozbase/mozfile",
27 "testing/mozbase/mozprocess",
28 "third_party/python/futures",
29 "third_party/python/jsmin",
30 "third_party/python/which",
31 "toolkit/components/glean/sphinx",
34 sys.path[:0] = [os.path.join(topsrcdir, p) for p in EXTRA_PATHS]
36 sys.path.insert(0, OUR_DIR)
38 extensions = [
39 "sphinx.ext.autodoc",
40 "sphinx.ext.autosectionlabel",
41 "sphinx.ext.doctest",
42 "sphinx.ext.graphviz",
43 "sphinx.ext.napoleon",
44 "sphinx.ext.todo",
45 "mozbuild.sphinx",
46 "sphinx_js",
47 "sphinxcontrib.mermaid",
48 "recommonmark",
49 "sphinx_copybutton",
50 "sphinx_markdown_tables",
51 "sphinx_panels",
52 "glean",
55 # JSDoc must run successfully for dirs specified, so running
56 # tree-wide (the default) will not work currently.
57 js_source_path = [
58 "../browser/components/extensions",
59 "../browser/components/uitour",
60 "../testing/marionette",
61 "../toolkit/components/extensions",
62 "../toolkit/components/extensions/parent",
63 "../toolkit/components/featuregates",
64 "../toolkit/mozapps/extensions",
65 "../toolkit/components/prompts/src",
66 "../toolkit/components/pictureinpicture",
67 "../toolkit/components/pictureinpicture/content",
69 root_for_relative_js_paths = ".."
70 jsdoc_config_path = "jsdoc.json"
72 templates_path = ["_templates"]
73 source_suffix = [".rst", ".md"]
74 master_doc = "index"
75 project = "Firefox Source Docs"
76 html_logo = os.path.join(
77 topsrcdir, "browser/branding/nightly/content/firefox-wordmark.svg"
79 html_favicon = os.path.join(topsrcdir, "browser/branding/nightly/firefox.ico")
81 exclude_patterns = ["_build", "_staging", "_venv"]
82 pygments_style = "sphinx"
84 # We need to perform some adjustment of the settings and environment
85 # when running on Read The Docs.
86 on_rtd = os.environ.get("READTHEDOCS", None) == "True"
88 if on_rtd:
89 # SHELL isn't set on RTD and mach.mixin.process's import raises if a
90 # shell-related environment variable can't be found. Set the variable here
91 # to hack us into working on RTD.
92 assert "SHELL" not in os.environ
93 os.environ["SHELL"] = "/bin/bash"
94 else:
95 # We only need to set the RTD theme when not on RTD because the RTD
96 # environment handles this otherwise.
97 import sphinx_rtd_theme
99 html_theme = "sphinx_rtd_theme"
100 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
103 html_static_path = ["_static"]
104 htmlhelp_basename = "MozillaTreeDocs"
106 moz_project_name = "main"
108 html_show_copyright = False
110 # Only run autosection for the page title.
111 # Otherwise, we have a huge number of duplicate links.
112 # For example, the page https://firefox-source-docs.mozilla.org/code-quality/lint/
113 # is called "Linting"
114 # just like https://firefox-source-docs.mozilla.org/remote/CodeStyle.html
115 autosectionlabel_maxdepth = 1
118 def setup(app):
119 app.add_config_value(
120 "recommonmark_config",
122 # Crashes with sphinx
123 "enable_inline_math": False,
124 # We use it for testing/web-platform/tests
125 "enable_eval_rst": True,
127 True,
129 app.add_stylesheet("custom_theme.css")
130 app.add_transform(AutoStructify)