提交 437e5edf 编写于 作者: M Mars Liu

support markdown code

上级 a07645f6
...@@ -192,9 +192,13 @@ def paragraph(state): ...@@ -192,9 +192,13 @@ def paragraph(state):
@Parsec @Parsec
def code(state): def code(state):
left = attempt(string("```")).then(many(attempt(inline))).over(string("\n")) side = choice(attempt(string("````")), string("```"))
left = many(attempt(inline)).over(string("\n"))
side_token = side(state)
language = ''.join(left(state)) language = ''.join(left(state))
right = attempt(string("\n```").over(choice(attempt(string("\n")), eof)))
right = attempt(string("\n"+side_token).over(choice(attempt(string("\n")), eof)))
buffer = "" buffer = ""
while True: while True:
try: try:
......
...@@ -367,7 +367,7 @@ class TreeWalker: ...@@ -367,7 +367,7 @@ class TreeWalker:
export.append(mfile) export.append(mfile)
flag = True flag = True
config["export"] = export config["export"] = export
with open(md_file, encoding="utf-8") as efile: with open(md_file, "r", encoding="utf-8") as efile:
data = efile.read() data = efile.read()
state = BasicState(data) state = BasicState(data)
try: try:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册