1.8.1 强调块正式支持变量赋值
This commit is contained in:
parent
ff42b7683c
commit
4133cbe6b3
@ -310,6 +310,6 @@ class Code(Extension):
|
|||||||
# md.treeprocessors.register(CodeBlock(), 'code_block', 1) # 渲染多行代码块
|
# md.treeprocessors.register(CodeBlock(), 'code_block', 1) # 渲染多行代码块
|
||||||
|
|
||||||
|
|
||||||
def main(text: str) -> Tuple[str, Dict[str, List[str]]]:
|
def main(text: str, variable: Dict) -> Tuple[str, Dict[str, List[str]]]:
|
||||||
md = Markdown(extensions=[Basic(), Box(), Anchor()] + list(Extensions.values()) + [Code({'a': 'b', '强调变量': '强调值'})])
|
md = Markdown(extensions=[Basic(), Box(), Anchor()] + list(Extensions.values()) + [Code(variable=variable)])
|
||||||
return md.convert(text), md.Meta
|
return md.convert(text), md.Meta
|
||||||
|
File diff suppressed because one or more lines are too long
5
run.py
5
run.py
@ -8,7 +8,10 @@ if __name__ == '__main__':
|
|||||||
start_time = time.perf_counter_ns()
|
start_time = time.perf_counter_ns()
|
||||||
# 主程序
|
# 主程序
|
||||||
with open('README.md', encoding='utf-8') as test:
|
with open('README.md', encoding='utf-8') as test:
|
||||||
cd, meta = main(test.read())
|
cd, meta = main(test.read(), variable={
|
||||||
|
'a': 'b',
|
||||||
|
'强调变量': '强调值'
|
||||||
|
})
|
||||||
print(meta)
|
print(meta)
|
||||||
with open('README.html', 'w', encoding='utf-8') as html:
|
with open('README.html', 'w', encoding='utf-8') as html:
|
||||||
html.write(f"""<!DOCTYPE html>
|
html.write(f"""<!DOCTYPE html>
|
||||||
|
Loading…
Reference in New Issue
Block a user