Tools for converting RST files to MyST-NB files
These instructions are from @najuzilu
Pandoc
. See ./rst_to_md.sh
.Pandoc
. For this reason, it is essential to go over the documents and make sure no math label is missing in the newly generated markdown files.def get_contents_depth(string):
r"""
Replace contents depth directives in rST to MyST syntax.
Paramater
---------
string: String
String which could containt the rST syntax regarding contents depth
"""
oldSyntax = "::: {.contents}\n\ndepth\n\n: 2\n:::"
newSyntax = "``` {contents}\n---\ndepth: 2\n---\n```"
# If found
if (string.find(oldSyntax) != -1):
string = string.replace(oldSyntax, newSyntax)