From ae27fc1e0d81848e88a4423f54f0822b2ab9a1a9 Mon Sep 17 00:00:00 2001 From: crossdark Date: Mon, 25 Nov 2024 19:20:30 +0800 Subject: [PATCH] =?UTF-8?q?3.4.7=20=E7=AE=80=E5=8C=96=E4=BA=86=E5=8D=95?= =?UTF-8?q?=E8=A1=8C=E4=BB=A3=E7=A0=81=E7=9A=84=E6=A0=BC=E5=BC=8F,?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E4=BA=86{}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CrossDown/Core.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CrossDown/Core.py b/CrossDown/Core.py index 21dfc96..33c6d3c 100644 --- a/CrossDown/Core.py +++ b/CrossDown/Core.py @@ -188,6 +188,9 @@ class BasicExtension(Extension): class InlineCode: + """ + 生成InlineHiliteExtension的自定义格式化器 + """ def __init__(self, variable: Variable): """ 初始化 @@ -195,14 +198,14 @@ class InlineCode: """ self.variable = variable - def __call__(self, source: str, language: str, css_class: str, md: markdown.core.Markdown) -> str: # 自定义的单行代码格式化器 + def __call__(self, source: str, language: str, css_class: str, md: markdown.core.Markdown) -> str | ElementTree: # 自定义的单行代码格式化器 """ InlineHiliteExtension的自定义格式化器 :param source: 原始单行代码 :param language: 输入的语言,未输入则为'' - :param css_class: - :param md: - :return: + :param css_class: 最初通过 custom_inline 项中的 class 选项定义的类名 + :param md: Markdown 类对象 + :return: HTML字符串或ElementTree对象 """ if language != '': # 字符串已经定义了语言类型 return md.inlinePatterns['backtick'].highlight_code(