forked from splunk/public-o11y-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.py
201 lines (155 loc) · 5.16 KB
/
conf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
######################################################################
# SPLUNK OBSERVABILITY CLOUD DOCUMENTATION BUILD CONFIGURATION FILE #
######################################################################
# GENERAL CONFIGURATION
#######################
import sys
import os
# Add the _ext directory to sys.path, so that Sphinx can find extensions in _ext.
sys.path.insert(0, os.path.join(os.path.abspath('.'), '_ext'))
from assetminify import final_conf_includes
extensions = [
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.ifconfig',
'sphinx_copybutton',
'notfound.extension',
'toggle',
'newpage',
'github',
'myst_parser',
'sphinx_tabs.tabs',
'olly_on_git_hub'
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
source_suffix = {
'.rst': 'restructuredtext',
'.md': 'markdown'
}
master_doc = 'index'
project = 'Splunk'
copyright = '2023 Splunk, Inc'
author = 'Splunk'
version = ''
release = ''
language = 'en'
exclude_patterns = ['_build', 'venv/lib/*/site-packages', 'Thumbs.db', '.DS_Store','z_cheat-sheets', 'README.md', 'CONTRIBUTING.md', '.github/pull_request_template.md', 'gdi/couchdb/couchdb.md', 'apm/find-root-cause.rst']
# THEME CONFIGURATION
#######################
pygments_style = 'sphinx'
todo_include_todos = False
html_theme = 'alabaster'
html_baseurl = "https://docs.splunk.com/Observability/"
html_title = 'Splunk Observability Cloud documentation'
html_favicon = 'favicon.ico'
html_static_path = ['_static']
html_sidebars = {
'**': [
# 'searchbox.html',
'about.html',
'fulltoc.html',
'relations.html',
]
}
html_theme_options = {
'logo_name': True,
'github_button': False,
}
html_permalinks_icon = u' 🔗'
htmlhelp_basename = 'Splunkdoc'
# EXTENSION SETTINGS
#######################
# GitHub edit links settings
olly_on_github_repo = 'splunk/public-o11y-docs'
olly_on_github_branch = 'main'
# Tabs settings
sphinx_tabs_disable_tab_closing = True
# Not found extension settings
notfound_template = '404.html'
notfound_urls_prefix = '/Observability/'
# Set myst_parser to automatically generate labels for h1, h2, and h3 headings
myst_heading_anchors = 3
# Copy button settings
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
copybutton_prompt_is_regexp = True
copybutton_copy_empty_lines = False
copybutton_line_continuation_character = "\\"
# ROLES AND MACROS
#######################
rst_prolog = """
.. role:: not-ok
.. role:: ok
.. role:: note
.. role:: strong
.. role:: title
.. role:: monospace
.. role:: strike
.. |more| raw:: html
⋯
.. |verticaldots| raw:: html
⋮
.. |takeshift| image:: /_images/incident-intelligence/Incident-intelligence-take-shift-icon.png
:alt: Take shift
:class: inline-image
.. |br| raw:: html
<br />
.. |hr| raw:: html
<hr />
"""
# An RST epilog to add variable names for feature text replacement, and non-breaking space.
rst_epilog = """
.. |ms| replace:: Metrics Sidebar
.. |mtab| replace:: Muting Rules tab
.. |sn| replace:: ServiceNow
.. |sv| replace:: secondary visualization
.. |openmenu| replace:: Open the Detector
menu by clicking the bell icon at the top right corner of a chart.
.. |nbsp| unicode:: 0xA0
:trim:
.. |hyph| unicode:: 0x2011
:trim:
"""
# FUNCTIONS AND SETUP
#######################
def on_page_context(app, pagename, templatename, context, doctree):
"""
This injects the ``get_local_toc`` function into the document.
The logic around the builder is because the JSON and other HTML builders,
they will error because we've added a Python function into the context.
So we have to make sure we're only putting this into HTML builders,
and ones that don't serialize the context.
"""
if getattr(app.builder, 'implementation', None) or app.builder.format != 'html':
return
context['get_local_toc'] = app.builder._get_local_toctree
def determine_local_toc(app, pagename, templatename, context, doctree):
"""
This code determines the set of documents that get a local TOC in the sidebar.
Any new books can be added to the ``books`` list here,
and they will be given the proper local TOC sidebar.
The actual implementation is in ``_templates/fulltoc.html``,
where we show the proper toc depending on the ``show_local_toc`` variable here.
"""
books = []
localtoc = False
for book in books:
if pagename.startswith(book):
localtoc = True
break
context['show_local_toc'] = localtoc
def setup(app):
# don't include any js or css file here or any other .py files , instead use only _ext/assetminify.py file
app.add_css_file('main.min.css')
app.add_js_file('main.min.js')
massets = final_conf_includes
for asstname in massets:
if asstname.endswith('.js'):
app.add_js_file(asstname)
if asstname.endswith('.css'):
app.add_css_file(asstname)
app.connect('html-page-context', on_page_context)
app.connect('html-page-context', determine_local_toc)
# app.add_stylesheet('signalfx-fonts.css')
# END OF SETTINGS FILE
#######################