1.7.3 修复了一部分乱码
This commit is contained in:
parent
990f72763a
commit
bfe171fade
@ -12,22 +12,16 @@ import emoji
|
||||
|
||||
Extensions = {
|
||||
"Extra": "markdown.extensions.extra",
|
||||
"Abbreviations": "markdown.extensions.abbr",
|
||||
"Attribute Lists": "markdown.extensions.attr_list",
|
||||
"Definition Lists": "markdown.extensions.def_list",
|
||||
"Fenced Code Blocks": "markdown.extensions.fenced_code",
|
||||
"Footnotes": "markdown.extensions.footnotes",
|
||||
"Tables": "markdown.extensions.tables",
|
||||
# "Smart Strong": "markdown.extensions.smart_strong",
|
||||
"Admonition": "markdown.extensions.admonition",
|
||||
# "CodeHilite": "markdown.extensions.codehilite",
|
||||
# "HeaderId": "markdown.extensions.headerid",
|
||||
"Meta-Data": "markdown.extensions.meta",
|
||||
"New Line to Break": "markdown.extensions.nl2br",
|
||||
# "New Line to Break": "markdown.extensions.nl2br",
|
||||
"Sane Lists": "markdown.extensions.sane_lists",
|
||||
"SmartyPants": "markdown.extensions.smarty",
|
||||
# "SmartyPants": "markdown.extensions.smarty",
|
||||
"Table of Contents": "markdown.extensions.toc",
|
||||
"WikiLinks": "markdown.extensions.wikilinks",
|
||||
# "WikiLinks": "markdown.extensions.wikilinks",
|
||||
}
|
||||
|
||||
try: # 检测当前平台是否支持扩展语法
|
||||
@ -225,6 +219,16 @@ class CodeLine(Treeprocessor):
|
||||
code.text = code.text[1:-1]
|
||||
|
||||
|
||||
class CodeBlock(Treeprocessor):
|
||||
def run(self, root):
|
||||
for elem in root: # 在所有段落中查找单行代码
|
||||
print(elem.tag)
|
||||
print(elem.text)
|
||||
print('----------------------------------------------------------------------------------------')
|
||||
for code in elem.findall('code'): # 找到代码块
|
||||
pass
|
||||
|
||||
|
||||
class Basic(Extension):
|
||||
"""
|
||||
渲染基本样式
|
||||
@ -280,7 +284,8 @@ class Anchor(Extension):
|
||||
class Code(Extension):
|
||||
def extendMarkdown(self, md: Markdown) -> None:
|
||||
md.registerExtension(self) # 注册扩展
|
||||
md.treeprocessors.register(CodeLine(), 'code_block', 0) # 渲染多行代码块
|
||||
md.treeprocessors.register(CodeLine(), 'code_line', 0) # 渲染单行代码块
|
||||
md.treeprocessors.register(CodeBlock(), 'code_block', 0) # 渲染多行代码块
|
||||
|
||||
|
||||
def main(text: str) -> Tuple[str, Dict[str, List[str]]]:
|
||||
|
@ -31,12 +31,7 @@ HEAD = (
|
||||
|
||||
BODY = (
|
||||
'<script>',
|
||||
' mermaid.initialize({{startOnLoad:true}});',
|
||||
'</script>',
|
||||
'<script>',
|
||||
' document.addEventListener("DOMContentLoaded", function() {',
|
||||
' emojify.run();',
|
||||
'});',
|
||||
' mermaid.initialize({startOnLoad:true});',
|
||||
'</script>',
|
||||
)
|
||||
|
||||
|
19
README.html
19
README.html
@ -19,12 +19,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
mermaid.initialize({{startOnLoad:true}});
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
emojify.run();
|
||||
});
|
||||
mermaid.initialize({startOnLoad:true});
|
||||
</script>
|
||||
<div class="toc">
|
||||
<ul>
|
||||
@ -128,7 +123,8 @@
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="crossdown">CrossDown</h1>
|
||||
<p>自制的markdown,添加了一些自定义的语法klzzwxh:0001效果请见klzzwxh:0000</p>
|
||||
<p>自制的markdown,添加了一些自定义的语法
|
||||
效果请见<a href="https://github.com/CrossDark/CrossDown/blob/main/README.html">README.html</a></p>
|
||||
<h1 id="1">1 基本语法</h1>
|
||||
<h2 id="1.1">1.1 标题</h2>
|
||||
<h1 id="_1">一级标题</h1>
|
||||
@ -223,7 +219,7 @@
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<p>引文内添加klzzwxhklzzwxhklzzwxh:00470044klzzwxh:0045</p>
|
||||
<p>引文内添加klzzwxhklzzwxhklzzwxh:00390036klzzwxh:0037</p>
|
||||
</blockquote>
|
||||
<h1 id="7">7 提纲</h1>
|
||||
<h2 id="7.1">7.1 提纲号</h2>
|
||||
@ -233,11 +229,14 @@
|
||||
<p>.7.1.2 错误示范</p>
|
||||
<p>7.1.3. 错误示范</p>
|
||||
<p>不能出现两个及以上连续的点,例如:</p>
|
||||
<p>7..1…4 错误示范</p>
|
||||
<p>7..1...4 错误示范</p>
|
||||
<p>提纲号会被自动配置为锚点,可直接使用<a href="#7">7</a>76.1}</p>
|
||||
<h1 id="8">8 注释</h1>
|
||||
<h2 id="8.1">8.1 强注释</h2>
|
||||
<p>|=klzzwxhklzzwxhklzzwxh:00340029klzzwxh:0032=|</p>
|
||||
<p>|=
|
||||
无论如何都会被移除
|
||||
<code>放在代码块里也没用</code>
|
||||
=|</p>
|
||||
<h2 id="8.2">8.2 弱注释</h2>
|
||||
<!-- 这是注释 -->
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user