From fd9cc50535bfee646a1784e3184ce95f838a5f2c Mon Sep 17 00:00:00 2001
From: PC <@>
Date: Mon, 25 Nov 2024 11:24:24 +0800
Subject: [PATCH 1/3] -
---
.idea/CrossDown.iml | 2 +-
.idea/misc.xml | 5 ++++-
CrossDown/Core.py | 12 ++++++++++++
requirements.txt | 6 ++----
4 files changed, 19 insertions(+), 6 deletions(-)
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..7254ab9 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): # 自定义的单行代码格式化器
+ """
+ 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,
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
From bd3ac37fc62622091ac0c959757bd09b2039bc7d Mon Sep 17 00:00:00 2001
From: PC <@>
Date: Mon, 25 Nov 2024 11:34:00 +0800
Subject: [PATCH 2/3] -
---
CrossDown/Core.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CrossDown/Core.py b/CrossDown/Core.py
index 7254ab9..609adfd 100644
--- a/CrossDown/Core.py
+++ b/CrossDown/Core.py
@@ -198,8 +198,8 @@ class InlineCode:
def __call__(self, source: str, language: str, css_class: str, md: markdown.core.Markdown): # 自定义的单行代码格式化器
"""
InlineHiliteExtension的自定义格式化器
- :param source:
- :param language:
+ :param source: 原始单行代码
+ :param language: 输入的语言,未输入则为''
:param css_class:
:param md:
:return:
From 4dc2e04b4cddecd2bd8f8e01813bde1c068e7a46 Mon Sep 17 00:00:00 2001
From: PC <@>
Date: Mon, 25 Nov 2024 11:40:31 +0800
Subject: [PATCH 3/3] -
---
CrossDown/Core.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CrossDown/Core.py b/CrossDown/Core.py
index 609adfd..21dfc96 100644
--- a/CrossDown/Core.py
+++ b/CrossDown/Core.py
@@ -195,7 +195,7 @@ class InlineCode:
"""
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: 原始单行代码
@@ -288,7 +288,7 @@ def main(text: str, variable: Variable = None) -> tuple[str, Variable]:
{
'name': '*',
'class': 'block',
- 'format': InlineCode(variable=variable),
+ 'format': InlineCode(variable=variable), # 传入变量
},
]
),