forked from CrossDark/CrossDown
2.0.2 修bug
This commit is contained in:
parent
f08ae76089
commit
9d31d7e1e5
@ -36,7 +36,7 @@ class HighlightHtmlFormatter(HtmlFormatter):
|
|||||||
super().__init__(**options)
|
super().__init__(**options)
|
||||||
self.lang_str = lang_str.split('-')[-1]
|
self.lang_str = lang_str.split('-')[-1]
|
||||||
|
|
||||||
def _wrap_code(self, source):
|
def _wrap_code(self, source: str):
|
||||||
yield 0, f'<code class="{self.lang_str}">'
|
yield 0, f'<code class="{self.lang_str}">'
|
||||||
yield from source
|
yield from source
|
||||||
yield 0, '</code>'
|
yield 0, '</code>'
|
||||||
@ -329,7 +329,13 @@ class Code(Extension):
|
|||||||
md.treeprocessors.register(CodeLine(variable=self.variable), 'code_line', 0) # 渲染单行代码块
|
md.treeprocessors.register(CodeLine(variable=self.variable), 'code_line', 0) # 渲染单行代码块
|
||||||
|
|
||||||
|
|
||||||
def main(text: str, variable: Variable = None) -> Tuple[str, Dict[str, List[str]]]:
|
def main(text: str, variable: Variable = None) -> Tuple[str, Dict[str, Variable]]:
|
||||||
|
"""
|
||||||
|
主函数
|
||||||
|
:param text: 输入文本
|
||||||
|
:param variable: 变量字典
|
||||||
|
:return: 返回html与元数据字典
|
||||||
|
"""
|
||||||
if variable is None:
|
if variable is None:
|
||||||
variable = {}
|
variable = {}
|
||||||
md = Markdown(extensions=[Basic(), Box(), Anchor()] + list(Extensions.values()) + [Code(variable=variable)])
|
md = Markdown(extensions=[Basic(), Box(), Anchor()] + list(Extensions.values()) + [Code(variable=variable)])
|
||||||
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="CrossDown",
|
name="CrossDown",
|
||||||
version="2.0.1",
|
version="2.0.2",
|
||||||
author="CrossDark",
|
author="CrossDark",
|
||||||
author_email="liuhanbo333@icloud.com",
|
author_email="liuhanbo333@icloud.com",
|
||||||
description="CrossDark's MarkDown",
|
description="CrossDark's MarkDown",
|
||||||
|
Loading…
Reference in New Issue
Block a user