Skip to content

Commit cb2eee1

Browse files
authored
📚 DOCS: Fix build (#209)
By temporarily removing myst-nb
1 parent 4e5be66 commit cb2eee1

File tree

5 files changed

+37
-13
lines changed

5 files changed

+37
-13
lines changed

docs/_static/custom.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.code-cell > .highlight > pre {
2+
border-left-color: green;
3+
border-left-width: medium;
4+
border-left-style: solid;
5+
}

docs/architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# markdown-it design principles
44

5+
(md/data-flow)=
56
## Data flow
67

78
Input data is parsed via nested chains of rules. There are 3 nested chains -
@@ -157,10 +158,9 @@ renderer override, but can be more simple.
157158
You also can write your own renderer to generate other formats than HTML, such as
158159
JSON/XML... You can even use it to generate AST.
159160

160-
161161
## Summary
162162

163-
This was mentioned in [Data flow](#data-flow), but let's repeat sequence again:
163+
This was mentioned in [Data flow](md/data-flow), but let's repeat sequence again:
164164

165165
1. Blocks are parsed, and top level of token stream filled with block tokens.
166166
2. Content on inline containers is parsed, filling `.children` properties.

docs/conf.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,25 @@
3333
"sphinx.ext.autodoc",
3434
"sphinx.ext.viewcode",
3535
"sphinx.ext.intersphinx",
36-
"myst_nb",
36+
"myst_parser",
3737
"sphinx_copybutton",
38-
"sphinx_panels",
38+
"sphinx_design",
3939
]
4040

41-
# Add any paths that contain templates here, relative to this directory.
42-
templates_path = ["_templates"]
43-
4441
# List of patterns, relative to source directory, that match files and
4542
# directories to ignore when looking for source files.
4643
# This pattern also affects html_static_path and html_extra_path.
4744
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
4845

46+
nitpicky = True
4947
nitpick_ignore = [
5048
("py:class", "Match"),
49+
("py:class", "Path"),
5150
("py:class", "x in the interval [0, 1)."),
5251
("py:class", "markdown_it.helpers.parse_link_destination._Result"),
5352
("py:class", "markdown_it.helpers.parse_link_title._Result"),
5453
("py:class", "MarkdownIt"),
54+
("py:class", "RuleFunc"),
5555
("py:class", "_NodeType"),
5656
("py:class", "typing_extensions.Protocol"),
5757
]
@@ -70,7 +70,8 @@
7070
"repository_branch": "master",
7171
"path_to_docs": "docs",
7272
}
73-
panels_add_boostrap_css = False
73+
html_static_path = ["_static"]
74+
html_css_files = ["custom.css"]
7475

7576
# Add any paths that contain custom static files (such as style sheets) here,
7677
# relative to this directory. They are copied after the builtin static files,
@@ -100,7 +101,7 @@ def run_apidoc(app):
100101
this_folder = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
101102
api_folder = os.path.join(this_folder, "api")
102103
module_path = os.path.normpath(os.path.join(this_folder, "../"))
103-
ignore_paths = ["../setup.py", "../conftest.py", "../tests", "../benchmarking"]
104+
ignore_paths = ["../profiler.py", "../conftest.py", "../tests", "../benchmarking"]
104105
ignore_paths = [
105106
os.path.normpath(os.path.join(this_folder, p)) for p in ignore_paths
106107
]
@@ -120,6 +121,7 @@ def run_apidoc(app):
120121

121122
argv = ["-M", "--separate", "-o", api_folder, module_path] + ignore_paths
122123

124+
apidoc.OPTIONS.append("ignore-module-all")
123125
apidoc.main(argv)
124126

125127
# we don't use this
@@ -131,3 +133,17 @@ def setup(app):
131133
"""Add functions to the Sphinx setup."""
132134
if os.environ.get("SKIP_APIDOC", None) is None:
133135
app.connect("builder-inited", run_apidoc)
136+
137+
from sphinx.directives.code import CodeBlock
138+
139+
class CodeCell(CodeBlock):
140+
"""Custom code block directive."""
141+
142+
def run(self):
143+
"""Run the directive."""
144+
self.options["class"] = ["code-cell"]
145+
return super().run()
146+
147+
# note, these could be run by myst-nb,
148+
# but currently this causes a circular dependency issue
149+
app.add_directive("code-cell", CodeCell)

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ compare = [
4747
linkify = ["linkify-it-py~=1.0"]
4848
plugins = ["mdit-py-plugins"]
4949
rtd = [
50-
"myst-nb==0.13.0a1",
50+
"myst-parser",
5151
"pyyaml",
52-
"sphinx>=2,<4",
52+
"sphinx",
5353
"sphinx-copybutton",
54-
"sphinx-panels~=0.4.0",
54+
"sphinx-design",
5555
"sphinx_book_theme",
5656
]
5757
testing = [

tox.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@ commands = pytest benchmarking/bench_packages.py {posargs}
3737

3838
[testenv:docs-{update,clean}]
3939
extras = linkify,plugins,rtd
40-
whitelist_externals = rm
40+
whitelist_externals =
41+
echo
42+
rm
4143
setenv =
4244
update: SKIP_APIDOC = true
4345
commands =
4446
clean: rm -rf docs/_build
4547
sphinx-build -nW --keep-going -b {posargs:html} docs/ docs/_build/{posargs:html}
48+
commands_post = echo "open file://{toxinidir}/docs/_build/{posargs:html}/index.html"
4649

4750
[testenv:profile]
4851
description = run profiler (use e.g. `firefox .tox/prof/output.svg` to open)

0 commit comments

Comments
 (0)