1.8.1 强调块正式支持变量赋值

This commit is contained in:
跨越晨昏 2024-10-13 22:15:24 +08:00
parent ff42b7683c
commit 4133cbe6b3
3 changed files with 7 additions and 4 deletions

View File

@ -310,6 +310,6 @@ class Code(Extension):
# md.treeprocessors.register(CodeBlock(), 'code_block', 1) # 渲染多行代码块
def main(text: str) -> Tuple[str, Dict[str, List[str]]]:
md = Markdown(extensions=[Basic(), Box(), Anchor()] + list(Extensions.values()) + [Code({'a': 'b', '强调变量': '强调值'})])
def main(text: str, variable: Dict) -> Tuple[str, Dict[str, List[str]]]:
md = Markdown(extensions=[Basic(), Box(), Anchor()] + list(Extensions.values()) + [Code(variable=variable)])
return md.convert(text), md.Meta

File diff suppressed because one or more lines are too long

5
run.py
View File

@ -8,7 +8,10 @@ if __name__ == '__main__':
start_time = time.perf_counter_ns()
# 主程序
with open('README.md', encoding='utf-8') as test:
cd, meta = main(test.read())
cd, meta = main(test.read(), variable={
'a': 'b',
'强调变量': '强调值'
})
print(meta)
with open('README.html', 'w', encoding='utf-8') as html:
html.write(f"""<!DOCTYPE html>