diff --git a/.idea/CrossDown.iml b/.idea/CrossDown.iml index 16f901c..7eb75f8 100644 --- a/.idea/CrossDown.iml +++ b/.idea/CrossDown.iml @@ -7,7 +7,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index 3eed65b..1d3ce46 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,7 @@ - + + + \ No newline at end of file diff --git a/CrossDown/Core.py b/CrossDown/Core.py index 0ecc2e8..21dfc96 100644 --- a/CrossDown/Core.py +++ b/CrossDown/Core.py @@ -189,9 +189,21 @@ class BasicExtension(Extension): class InlineCode: def __init__(self, variable: Variable): + """ + 初始化 + :param variable: 变量字典 + """ self.variable = variable - def __call__(self, source: str, language: str, css_class: str, md: markdown.core.Markdown): # 自定义的单行代码格式化器 + def __call__(self, source: str, language: str, css_class: str, md: markdown.core.Markdown) -> str: # 自定义的单行代码格式化器 + """ + InlineHiliteExtension的自定义格式化器 + :param source: 原始单行代码 + :param language: 输入的语言,未输入则为'' + :param css_class: + :param md: + :return: + """ if language != '': # 字符串已经定义了语言类型 return md.inlinePatterns['backtick'].highlight_code( src=source, language=language, classname=css_class, @@ -276,7 +288,7 @@ def main(text: str, variable: Variable = None) -> tuple[str, Variable]: { 'name': '*', 'class': 'block', - 'format': InlineCode(variable=variable), + 'format': InlineCode(variable=variable), # 传入变量 }, ] ), diff --git a/requirements.txt b/requirements.txt index ce5108a..76d299f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,7 @@ Markdown>=3.7 -matplotlib~=3.8.2 -numpy~=1.26.2 pygments>=2.18.0 -CrossDown>=2.2.0 setuptools~=70.1.1 emoji~=2.13.2 pymdown-extensions>=10.12 -kbdextension>=1.0.1 \ No newline at end of file +kbdextension>=1.0.1 +markdown_gfm_admonition>=0.1.1 \ No newline at end of file