1.9.6 修bug
This commit is contained in:
parent
280518f985
commit
d6107c6adf
@ -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
|
||||
|
@ -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;} /* 灰色背景,白色文字 */
|
||||
|
Loading…
Reference in New Issue
Block a user