From 90b50d1440038f2e1c3ce063c983d5c6f7b7402a Mon Sep 17 00:00:00 2001 From: crossdark Date: Sun, 22 Sep 2024 12:42:46 +0800 Subject: [PATCH] =?UTF-8?q?0.8.6=E6=8F=90=E7=BA=B2=E5=8F=B7=E5=8F=AF?= =?UTF-8?q?=E7=AE=97=E6=95=B4=E5=A5=BD=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CrossDown.py | 6 +++++- README.html | 16 ++++++++++++---- README.md | 7 ++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/CrossDown.py b/CrossDown.py index 6410a3a..0e435ea 100644 --- a/CrossDown.py +++ b/CrossDown.py @@ -232,6 +232,8 @@ class CodeBlock: self.codes[index] = f'
{re.sub(f"({head})", "", code)}
' elif re.match(r'\$[^$]*\$', code): # 是LaTex代码(单行) self.codes[index] = re.sub(fr'\$([^$]*)\$', r'

\(\1\)

', code) + elif re.match(r'¥[^$]*¥', code): # 是数学函数(单行) + self.codes[index] = re.sub(fr'¥([^$]*)¥', r'

\(\1\)

', code) else: # 是突出块 self.codes[index] = f'{code}' @@ -326,7 +328,9 @@ class Syllabus: re.sub(f'^({match.groups()[0]})', fr'{"#" * len(match.groups()[0].split("."))} \1{{#' + match.groups()[0] + '}', origen) if match is not None else origen) # 对于不是提纲的行,直接返回原始字符 - (re.match(r'^([\d.]+) ', line), line) # 匹配提纲号 + ((lambda x: re.match(r'^([\d.]+) ', x) # 判断是否是提纲 + if not any((x.startswith('.'), re.search('\. ', x) is not None)) + else None)(line), line) # 排除.在提纲号开头或结尾的情况 for line in self.text.splitlines() # 分割并遍历文本的每一行 ]) diff --git a/README.html b/README.html index ea74e2c..18b5a87 100644 --- a/README.html +++ b/README.html @@ -117,6 +117,12 @@

引文内添加斜体粗体下划线删除线高亮

6 提纲

+

6.1 提纲号

+

以数字和点组成,通过空格与提纲名分隔,例如:

+

6.1.1 提纲号示例

+

点不能出现在开头或结尾,例如 + .6.1.2 错误示范 + 6.1.3. 错误示范

7 注释

7.1 强注释

7.2 弱注释

@@ -124,10 +130,12 @@ // 代码中的注释弱不会被移除

8 列表

8.1 有序列表

-

1. a

-

2. b

-

3. c

-

4. d

+
    +
  1. a
  2. +
  3. b
  4. +
  5. c
  6. +
  7. d
  8. +

8.2 无序列表