From d6107c6adfa0bbe7bed8b8483a99245b88bf59fb Mon Sep 17 00:00:00 2001 From: crossdark Date: Wed, 16 Oct 2024 19:55:23 +0800 Subject: [PATCH] =?UTF-8?q?1.9.6=20=E4=BF=AEbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CrossDown/Core.py | 6 +++++- Static/styles.css | 2 ++ setup.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CrossDown/Core.py b/CrossDown/Core.py index 2900717..9fea80d 100644 --- a/CrossDown/Core.py +++ b/CrossDown/Core.py @@ -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 diff --git a/Static/styles.css b/Static/styles.css index c4b2fd9..7687fb9 100644 --- a/Static/styles.css +++ b/Static/styles.css @@ -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;} /* 灰色背景,白色文字 */ diff --git a/setup.py b/setup.py index ce4b9ba..a0a134c 100644 --- a/setup.py +++ b/setup.py @@ -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",