Merge pull request 'main' (#1) from CrossLight/CrossDown:main into main
Reviewed-on: https://crossdark.com/CrossDark/CrossDown/pulls/1
This commit is contained in:
commit
8c7ec0b993
@ -7,7 +7,7 @@
|
||||
<excludeFolder url="file://$MODULE_DIR$/dist" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.11 (CrossDown)" jdkType="Python SDK" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.13" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PackageRequirementsSettings">
|
||||
|
@ -1,4 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (CrossDown)" project-jdk-type="Python SDK" />
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.13" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13" project-jdk-type="Python SDK" />
|
||||
</project>
|
@ -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), # 传入变量
|
||||
},
|
||||
]
|
||||
),
|
||||
|
@ -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
|
||||
kbdextension>=1.0.1
|
||||
markdown_gfm_admonition>=0.1.1
|
Loading…
Reference in New Issue
Block a user