forked from CrossDark/CrossDown
1.7.1 强调好了
This commit is contained in:
parent
b22a4f319e
commit
30670780e8
@ -199,11 +199,20 @@ class CodeLine(Treeprocessor):
|
||||
if elem.findall('code'): # 找到单行代码
|
||||
for code in elem:
|
||||
if re.match(r'\$[^$]*\$', code.text): # 渲染Latex
|
||||
if isinstance(elem.text, str):
|
||||
elem.text += fr'\({code.text[1:-1]}\){code.tail}'
|
||||
if isinstance(elem.text, str): # 这个段落还有其它内容
|
||||
elem.text += fr'\({code.text[1:-1]}\){code.tail}' # 插入latex
|
||||
else:
|
||||
elem.text = fr'\({code.text}\)'
|
||||
elem.text = fr'\({code.text}\)' # latex是段落中唯一的内容
|
||||
elem.remove(code)
|
||||
elif re.match(r'¥[^$]*¥', code.text): # 是数学函数(单行)
|
||||
if EXTRA_ABLE:
|
||||
expression, range_ = re.findall(r'¥([^$]*)¥(€[^$]*€)?', code)[0] # 分离表达式与范围(如果有)
|
||||
x_r = (-10, 10)
|
||||
y_r = (-20, 20)
|
||||
elif re.match(r'\{[^$]*}', code.text): # 是强调
|
||||
code.tag = 'span'
|
||||
code.set('class', 'block')
|
||||
code.text = code.text[1:-1]
|
||||
|
||||
|
||||
class Basic(Extension):
|
||||
|
12
README.html
12
README.html
@ -179,7 +179,7 @@
|
||||
<p><code>¥y=x**2¥€-50,50€</code> // 定义了x范围</p>
|
||||
<p><code>¥y=x**3¥€-50,50|-100,100€</code> // 定义了y范围</p>
|
||||
<h3 id="4.1.3">4.1.3 强调</h3>
|
||||
<p><code>{强调文本}</code></p>
|
||||
<p><span class="block">强调文本</span></p>
|
||||
<h2 id="4.2">4.2 多行</h2>
|
||||
<h3 id="4.2.1">4.2.1 YAML</h3>
|
||||
<pre><code class="language-yaml">A:
|
||||
@ -195,11 +195,11 @@
|
||||
<pre><code class="language-python">print('CrossDown')
|
||||
</code></pre>
|
||||
<h3 id="4.2.3">4.2.3 Mermaid</h3>
|
||||
<pre><code class="language-mermaid">graph LR
|
||||
A-->B
|
||||
A-->C
|
||||
B-->D
|
||||
C-->D
|
||||
<pre><code class="language-mermaid">graph TD
|
||||
A[开始]-->B[流程]
|
||||
B-->C{判断}
|
||||
C-->|结果1|D[结束1]
|
||||
C-->|结果2|E[结束2]
|
||||
</code></pre>
|
||||
<h1 id="5">5 转义</h1>
|
||||
<p>\ </p>
|
||||
|
Loading…
Reference in New Issue
Block a user