1.9.6 修bug

This commit is contained in:
跨越晨昏 2024-10-16 19:55:23 +08:00
parent 280518f985
commit d6107c6adf
3 changed files with 8 additions and 2 deletions

View File

@ -24,6 +24,7 @@ class HighlightHtmlFormatter(HtmlFormatter):
"""
用于给code highlight扩展添加语言类型
"""
def __init__(self, lang_str='', **options):
"""
初始化
@ -209,6 +210,7 @@ class CodeLine(Treeprocessor):
"""
渲染单行代码
"""
def __init__(self, variable: Dict):
super().__init__()
self.variable = variable
@ -334,6 +336,8 @@ class Code(Extension):
# md.treeprocessors.register(CodeBlock(), 'code_block', 1) # 渲染多行代码块
def main(text: str, variable: Dict) -> Tuple[str, Dict[str, List[str]]]:
def main(text: str, variable: Union[Dict[str, str], None] = None) -> Tuple[str, Dict[str, List[str]]]:
if variable is None:
variable = {}
md = Markdown(extensions=[Basic(), Box(), Anchor()] + list(Extensions.values()) + [Code(variable=variable)])
return md.convert(text), md.Meta

View File

@ -73,3 +73,5 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left:
.codehilite .vi { color: #19177C } /* Name.Variable.Instance */
.codehilite .vm { color: #19177C } /* Name.Variable.Magic */
.codehilite .il { color: #666666 } /* Literal.Number.Integer.Long */
.block {background-color: grey; color: white;} /* 灰色背景,白色文字 */

View File

@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools.setup(
name="CrossDown",
version="2.0.0",
version="2.0.1",
author="CrossDark",
author_email="liuhanbo333@icloud.com",
description="CrossDark's MarkDown",