Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

鈾伙笍馃摎 Restructure code base and documentation #566

Merged
merged 8 commits into from May 12, 2022

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented May 12, 2022

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 (from myst_parser/main.py) and mock_sphinx_env/parse (from myst_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 and substitutions top-matter keys have also been deprecated (i.e. they will still work but will emit a warning), as they now form part of the myst config, e.g.

---
html_meta:
  "description lang=en": "metadata description"
substitutions:
  key1: I'm a **substitution**
---

is replaced by:

---
myst:
  html_meta:
    "description lang=en": "metadata description"
  substitutions:
    key1: I'm a **substitution**
---

@codecov
Copy link

codecov bot commented May 12, 2022

Codecov Report

Merging #566 (0676b68) into master (7dda7b5) will increase coverage by 0.19%.
The diff coverage is 88.61%.

@@            Coverage Diff             @@
##           master     #566      +/-   ##
==========================================
+ Coverage   89.64%   89.83%   +0.19%     
==========================================
  Files          17       20       +3     
  Lines        2154     2116      -38     
==========================================
- Hits         1931     1901      -30     
+ Misses        223      215       -8     
Flag Coverage 螖
pytests 89.83% <88.61%> (+0.19%) 猬嗭笍

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage 螖
myst_parser/mdit_to_docutils/utils.py 81.81% <酶> (酶)
myst_parser/mocking.py 87.05% <71.42%> (+0.83%) 猬嗭笍
myst_parser/mdit_to_docutils/html_to_nodes.py 90.74% <80.00%> (酶)
myst_parser/parsers/docutils_.py 81.08% <81.08%> (酶)
myst_parser/config/dc_validators.py 85.45% <82.75%> (酶)
myst_parser/config/main.py 86.91% <86.91%> (酶)
myst_parser/sphinx_ext/main.py 90.62% <90.62%> (酶)
myst_parser/mdit_to_docutils/base.py 92.26% <91.30%> (酶)
myst_parser/mdit_to_docutils/sphinx_.py 94.17% <92.30%> (酶)
myst_parser/parsers/mdit.py 96.72% <96.72%> (酶)
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 7dda7b5...0676b68. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant