#!/usr/bin/env python3 import re import sys from typing import List # Import local files from transform import transform from util import * from context import Context from group import Group from katex import KatexClient from html import html from tex import tex from mj_show import show doc = import_md(open(sys.argv[1], "r").read()) language = doc.get_metadata("language", None, True) print(show(doc)) context = Context(doc, sys.argv[1]) doc = doc.walk(transform, context) doc.content = [Group(*doc.content, metadata={"language":language})] #print("---------------------") #print(show(doc)) #print(convert_text(doc, input_format="panflute", output_format="markdown")) katexClient = KatexClient() #print(katexClient.render("\\def\\Bruh{K^A\\TeX}")) #print(katexClient.render("\\Bruh")) open("output.html", "w").write("
" + html(doc, katexClient)) open("output.tex", "w").write("\input formatitko.tex\n" + tex(doc)) #print(tex(doc))