From 4133cbe6b3d469b5ad81e97ff0e41ee8e91267bc Mon Sep 17 00:00:00 2001 From: crossdark Date: Sun, 13 Oct 2024 22:15:24 +0800 Subject: [PATCH] =?UTF-8?q?1.8.1=20=E5=BC=BA=E8=B0=83=E5=9D=97=E6=AD=A3?= =?UTF-8?q?=E5=BC=8F=E6=94=AF=E6=8C=81=E5=8F=98=E9=87=8F=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CrossDown/Core.py | 4 ++-- README.html | 2 +- run.py | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CrossDown/Core.py b/CrossDown/Core.py index 2d9dc3e..890ab99 100644 --- a/CrossDown/Core.py +++ b/CrossDown/Core.py @@ -310,6 +310,6 @@ class Code(Extension): # md.treeprocessors.register(CodeBlock(), 'code_block', 1) # 渲染多行代码块 -def main(text: str) -> Tuple[str, Dict[str, List[str]]]: - md = Markdown(extensions=[Basic(), Box(), Anchor()] + list(Extensions.values()) + [Code({'a': 'b', '强调变量': '强调值'})]) +def main(text: str, variable: Dict) -> Tuple[str, Dict[str, List[str]]]: + md = Markdown(extensions=[Basic(), Box(), Anchor()] + list(Extensions.values()) + [Code(variable=variable)]) return md.convert(text), md.Meta diff --git a/README.html b/README.html index 14f7405..badbaf3 100644 --- a/README.html +++ b/README.html @@ -184,7 +184,7 @@

Base64 函数图片 // 定义了y范围

4.1.3 强调

强调文本

-

强调值

+

变量值

4.2 多行

4.2.1 YAML

A:
diff --git a/run.py b/run.py
index 51d28cb..e584580 100644
--- a/run.py
+++ b/run.py
@@ -8,7 +8,10 @@ if __name__ == '__main__':
     start_time = time.perf_counter_ns()
     # 主程序
     with open('README.md', encoding='utf-8') as test:
-        cd, meta = main(test.read())
+        cd, meta = main(test.read(), variable={
+            'a': 'b',
+            '强调变量': '强调值'
+        })
         print(meta)
     with open('README.html', 'w', encoding='utf-8') as html:
         html.write(f"""