def test_commonmark(entry): if entry["example"] == 14: # This is just a test that +++ are not parsed as thematic breaks pytest.skip("Expects '+++' to be unconverted (not block break).") if entry["example"] in [66, 68]: # Front matter is supported by numerous Markdown flavours, # but not strictly CommonMark, # see: https://talk.commonmark.org/t/metadata-in-documents/721/86 pytest.skip( "Thematic breaks on the first line conflict with front matter syntax" ) if entry["example"] == 599: # <http://example.com/\\[\\>\n # TODO awaiting upstream fix pytest.skip("url backslash escaping") test_case = entry["markdown"] output = to_html(test_case) if entry["example"] == 593: # this doesn't have any bearing on the output output = output.replace("mailto", "MAILTO") if entry["example"] in [187, 209, 210]: # this doesn't have any bearing on the output output = output.replace("<blockquote></blockquote>", "<blockquote>\n</blockquote>") assert output == entry["html"]
def visit_glossary_reference(self, node): self.body.append('<span class="glossary-ref" ' + 'data-definition="' + b64(to_html(node["definition"])) + '" ' + 'data-number="' + node["number"] + '" ' + ('data-glossary-uri="' + node["uri"] + '" ' if node["uri"] is not None else '') + 'data-entry-name="' + b64(node["entry_name"]) + '">')
import sys from myst_parser.main import to_html infile = sys.argv[1] outfile = sys.argv[2] with open(infile, "r") as inf: content = inf.read() outf = to_html(content) with open(outfile, "w") as out: out.write(outf)
def save_sequence(week, seq, lines): filename = f"w{week}/w{week}-s{seq}-av-code.html" print(f"using {len(lines)} (markdown) lines to make {filename}") text ="".join(lines) with Path(filename).open('w') as writer: writer.write(to_html(text))