-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ REFACTOR: Move to markdown-it + mdformat renderer (#18)
Conversion now procedes via conversion to markdown-it tokens, followed by conversion to Markdown text with mdformat.
- Loading branch information
1 parent
1c0dee8
commit d40e96f
Showing
35 changed files
with
13,689 additions
and
1,218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: 2 | ||
|
||
python: | ||
version: 3 | ||
install: | ||
- method: pip | ||
path: . | ||
extra_requirements: | ||
- docs | ||
|
||
sphinx: | ||
builder: html | ||
fail_on_warning: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Python API | ||
========== | ||
|
||
Text to docutils AST | ||
-------------------- | ||
|
||
.. autofunction:: rst_to_myst.parser.to_docutils_ast | ||
|
||
docutils AST to Markdown-It Tokens | ||
----------------------------------- | ||
|
||
.. autoclass:: rst_to_myst.markdownit.RenderOutput | ||
:members: | ||
|
||
.. autoclass:: rst_to_myst.markdownit.MarkdownItRenderer | ||
:members: | ||
|
||
Markdown-It Tokens to Text | ||
-------------------------- | ||
|
||
.. autofunction:: rst_to_myst.mdformat_render.from_tokens | ||
|
||
Full Conversion | ||
--------------- | ||
|
||
.. autoclass:: rst_to_myst.mdformat_render.ConvertedOutput | ||
:members: | ||
|
||
.. autofunction:: rst_to_myst.mdformat_render.rst_to_myst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CLI Commands | ||
============ | ||
|
||
.. click:: rst_to_myst.cli:main | ||
:prog: rst2myst | ||
:nested: full |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"""Configuration for Sphinx documentation build. | ||
It is recommended to use tox to run the build (see tox.ini): | ||
`tox -e docs-clean` and `tox -e docs-update`, | ||
or directly: `sphinx-build -n -W --keep-going docs/source docs/_build` | ||
""" | ||
from rst_to_myst import __version__ | ||
|
||
project = "RST-to-MyST" | ||
copyright = "2021, Executable Book Project" # noqa: A001 | ||
author = "Executable Book Project" | ||
version = __version__ | ||
|
||
extensions = [ | ||
# read Markdown files | ||
"myst_parser", | ||
"sphinx_panels", | ||
# document CLI | ||
"sphinx_click", | ||
# document API | ||
"sphinx.ext.autodoc", | ||
"sphinx.ext.intersphinx", | ||
"sphinx.ext.viewcode", | ||
] | ||
|
||
html_theme = "sphinx_book_theme" | ||
html_title = f"RST-to-MyST: v{__version__}" | ||
html_theme_options = { | ||
"home_page_in_toc": True, | ||
"github_url": "https://github.com/executablebooks/rst-to-myst", | ||
"repository_url": "https://github.com/executablebooks/rst-to-myst", | ||
"use_issues_button": True, | ||
"use_repository_button": True, | ||
"repository_branch": "main", | ||
"path_to_docs": "docs", | ||
} | ||
|
||
intersphinx_mapping = { | ||
"python": ("https://docs.python.org/3.8", None), | ||
"sphinx": ("https://www.sphinx-doc.org/en/master", None), | ||
"markdown_it": ("https://markdown-it-py.readthedocs.io/en/latest", None), | ||
} | ||
|
||
nitpick_ignore = [ | ||
("py:class", name) for name in ["IO", "_io.StringIO", "docutils.nodes.document"] | ||
] |
Oops, something went wrong.