Skip to content

Commit 7c9eec1

Browse files
authored
📚 DOCS: Add the sphinx-tippy extension (#684)
1 parent ee4c29d commit 7c9eec1

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22

33
python:
4-
version: "3"
4+
version: "3.8"
55
install:
66
- method: pip
77
path: .

docs/_static/local.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/** Add a counter before subsections **/
2-
h1 {
2+
h1:not(.tippy-header) {
33
counter-reset: subsection;
44
text-decoration: underline;
55
}
6-
h2 {
6+
h2:not(.tippy-header) {
77
counter-reset: subsubsection;
88
}
9-
h2::before {
9+
h2:not(.tippy-header)::before {
1010
counter-increment: subsection;
1111
content: counter(subsection) ". ";
1212
}
13-
h3::before {
13+
h3:not(.tippy-header)::before {
1414
counter-increment: subsubsection;
1515
content: counter(subsection) "." counter(subsubsection) ". ";
1616
}

docs/conf.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"sphinxcontrib.mermaid",
3737
"sphinxext.opengraph",
3838
"sphinx_pyscript",
39+
"sphinx_tippy",
3940
]
4041

4142
# Add any paths that contain templates here, relative to this directory.
@@ -149,6 +150,18 @@
149150
"explain/index.md": "develop/background.md",
150151
}
151152

153+
tippy_skip_anchor_classes = ("headerlink", "sd-stretched-link", "sd-rounded-pill")
154+
tippy_anchor_parent_selector = "article.bd-article"
155+
tippy_custom_tips = {
156+
"https://www.sphinx-doc.org/en/master/usage/configuration.html": """
157+
<p>The configuration directory must contain a file named
158+
<code class="file docutils literal notranslate"><span class="pre">conf.py</span></code>.
159+
This file (containing Python code) is called the “build configuration file”
160+
and contains (almost) all configuration needed to customize Sphinx input
161+
and output behavior.</p>
162+
"""
163+
}
164+
152165
# -- LaTeX output -------------------------------------------------
153166

154167
latex_engine = "xelatex"

docs/syntax/optional.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ myst:
2121
# Syntax Extensions
2222

2323
MyST-Parser is highly configurable, utilising the inherent "plugability" of the [markdown-it-py](inv:markdown_it#index) parser.
24-
The following syntaxes are optional (disabled by default) and can be enabled *via* the sphinx `conf.py` (see also [](sphinx/config-options)).
24+
The following syntaxes are optional (disabled by default) and can be enabled *via* the {{ confpy }} (see also [](sphinx/config-options)).
2525
Their goal is generally to add more *Markdown friendly* syntaxes; often enabling and rendering [markdown-it-py plugins](inv:markdown_it#md/plugins) that extend the [CommonMark specification](https://commonmark.org/).
2626

2727
To enable all the syntaxes explained below:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ rtd = [
6161
"sphinxcontrib.mermaid~=0.7.1",
6262
"sphinxext-opengraph~=0.7.5",
6363
"sphinx-pyscript",
64+
"sphinx-tippy>=0.3.1",
6465
]
6566
testing = [
6667
"beautifulsoup4",

0 commit comments

Comments
 (0)