From 04ed13411178d1c2c470853b223814248101779e Mon Sep 17 00:00:00 2001 From: crossdark Date: Sat, 31 Aug 2024 19:28:04 +0800 Subject: [PATCH] V0.5.1 --- CrossDown.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CrossDown.py b/CrossDown.py index 81c5063..94ae379 100644 --- a/CrossDown.py +++ b/CrossDown.py @@ -81,6 +81,9 @@ class Style: """ self.text = re.sub(r'\[(.*?)]-\((.*?)\)', r'\1', self.text) + def split_line(self): + self.text = re.sub(r'([*_-]){3}\n', r'
', self.text) + def __call__(self, *args, **kwargs): """ 一键运行 @@ -95,6 +98,7 @@ class Style: self.highlight() self.up() self.hide() + self.split_line() return self.text @@ -195,6 +199,8 @@ class CodeBlock: self.codes[index] = f'
{code}
' elif head in ('shell', 'python'): self.codes[index] = f'
{re.sub(f"({head})", "", code)}
' + elif head in ('mermaid',): + self.codes[index] = f'
{re.sub(f"({head})", "", code)}
' elif re.match(r'\$[^$]*\$', code): # 是LaTex代码(单行) self.codes[index] = re.sub(fr'\$([^$]*)\$', r'

\(\1\)

', code) else: # 是突出块 @@ -373,9 +379,13 @@ if __name__ == '__main__': color: white; /* 白色文字 */ }} + - + + {add_indent_to_string(cd, 4)}