Skip to content

Commit

Permalink
Use CONTRIBUTING template instead of automatic conversion
Browse files Browse the repository at this point in the history
Due to an [issue] the output generated by rst-to-myst does not work 100%.
Therefore a fixed template seems to be a temporary solution.

[issue]: executablebooks/rst-to-myst#33
  • Loading branch information
abravalheri authored and FlorianWilhelm committed Sep 18, 2021
1 parent d3b76ed commit 331c549
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ install_requires =
pyscaffold>=4.1rc1,<5.0a0
wheel>=0.31
myst-parser[linkify]
rst-to-myst[sphinx]>=0.3.2
# rst-to-myst[sphinx]>=0.3.2 # see issue #25


[options.packages.find]
Expand Down
20 changes: 9 additions & 11 deletions src/pyscaffoldext/markdown/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from pyscaffold.operations import no_overwrite
from pyscaffold.structure import merge, reify_leaf, reject
from pyscaffold.templates import get_template
from rst_to_myst.mdformat_render import rst_to_myst

from . import templates

Expand All @@ -23,12 +22,6 @@

DOC_REQUIREMENTS = ["myst-parser[linkify]"]

RST2MYST_OPTS: dict = {}
"""Options for the automatic conversion between reStructuredText and Markdown
See https://rst-to-myst.readthedocs.io/en/stable/api.html#full-conversion
"""


template = partial(get_template, relative_to=templates)

Expand Down Expand Up @@ -135,6 +128,7 @@ def replace_files(struct: Structure, opts: ScaffoldOpts) -> ActionParams:
"README.md": (template("readme"), NO_OVERWRITE),
"AUTHORS.md": (template("authors"), NO_OVERWRITE),
"CHANGELOG.md": (template("changelog"), NO_OVERWRITE),
"CONTRIBUTING.md": (template("contributing"), NO_OVERWRITE),
"docs": {
"index.md": (template("index"), NO_OVERWRITE),
"readme.md": (default_myst_include("README.md"), NO_OVERWRITE),
Expand All @@ -145,10 +139,14 @@ def replace_files(struct: Structure, opts: ScaffoldOpts) -> ActionParams:
},
}

# Automatically convert RST to MD
content, file_op = reify_leaf(struct.get("CONTRIBUTING.rst"), opts)
md_content = rst_to_myst(content or "", **RST2MYST_OPTS).text
files["CONTRIBUTING.md"] = (md_content, file_op)
# TODO: Automatically convert RST to MD
#
# >>> content, file_op = reify_leaf(struct.get("CONTRIBUTING.rst"), opts)
# >>> md_content = rst_to_myst(content or "", **RST2MYST_OPTS).text
# >>> files["CONTRIBUTING.md"] = (md_content, file_op)
#
# Currently there is a problem in rst-to-myst, preventing automatic conversion:
# https://github.com/executablebooks/rst-to-myst/issues/33#issuecomment-922264030

# Modify pre-existing files
content, file_op = reify_leaf(struct["setup.cfg"], opts)
Expand Down

0 comments on commit 331c549

Please sign in to comment.