formatitko/formatitko.py

30 lines
620 B
Python
Raw Normal View History

2022-11-20 00:20:41 +01:00
#!/usr/bin/env python3
2022-11-24 16:57:54 +01:00
import re
import sys
from typing import List
2022-11-20 00:20:41 +01:00
2023-01-30 01:46:50 +01:00
# Import local files
from transform import transform
2023-01-30 01:46:50 +01:00
from util import *
from context import Context
2023-02-02 02:50:33 +01:00
from html import html
2023-02-02 18:48:48 +01:00
from katex import KatexClient
2023-01-30 01:46:50 +01:00
2022-11-20 00:37:03 +01:00
from mj_show import show
2022-11-20 00:20:41 +01:00
2023-01-31 00:44:48 +01:00
doc = import_md(open(sys.argv[1], "r").read())
2023-02-02 02:50:33 +01:00
2022-11-20 00:37:03 +01:00
print(show(doc))
context = Context(doc)
doc = doc.walk(transform, context)
print("---------------------")
2023-02-02 02:50:33 +01:00
#print(show(doc))
#print(convert_text(doc, input_format="panflute", output_format="markdown"))
2023-02-02 18:48:48 +01:00
#open("output.html", "w").write("<head> <meta charset='utf-8'> </head>" + html(doc))
k = KatexClient()
input()
print(k)