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",