♻️📚 Restructure code base and documentation #566
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR restructures the code base into modules, to be more coherent as to the purpose of each module.
It also restructures the documentation, to make it easier for users to follow, and expose the core concerns at the top-level.
Finally, it introduces document-level configuration via the Markdown top-matter, under the
myst
key.This configuration is generated from the code
MdParserConfig
dataclass, so is inherently consistent with global configuration.The (YAML) top-matter of a MyST file is always read (within the docutils/sphinx parsers) before the full document is parsed, in order to acquire this file configuration, which overrides the default/global configuration (see
docs/configuration.md
).Breaking changes
This should not be breaking, for general users of the sphinx extension,
but will be for anyone directly using the Python API, mainly just requiring changes in import module paths.
The
to_docutils
,to_html
,to_tokens
(frommyst_parser/main.py
) andmock_sphinx_env
/parse
(frommyst_parser.sphinx_renderer.py
) functions have been removed.These were really just for testing, and were confusing for users, since they did not run the full sphinx build.
Instead, for single page builds, users should use the recently added docutils parser API/CLI (see
docs/docutils.md
),and for testing, functionality has been moved to https://github.com/chrisjsewell/sphinx-pytest.
The top-level
html_meta
andsubstitutions
top-matter keys have also been deprecated (i.e. they will still work but will emit a warning), as they now form part of themyst
config, e.g.is replaced by: