0.11.0 Emoji有点问题

This commit is contained in:
跨越晨昏 2024-09-28 12:49:37 +08:00
parent 3ccb727330
commit 3cac20d7f7
4 changed files with 60 additions and 25 deletions

View File

@ -10,6 +10,35 @@ except ModuleNotFoundError:
EXTRA_ABLE = False EXTRA_ABLE = False
HEAD = """
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<link href="https://cdn.jsdelivr.net/npm/prismjs/themes/prism.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/prismjs/prism.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs/components/prism-yaml.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<style>
.block {
background-color: grey; /* 灰色背景 */
color: white; /* 白色文字 */
}
</style>
"""
BODY = """
<script>
mermaid.initialize({{startOnLoad:true}});
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
emojify.run();
});
</script>
"""
class Style: class Style:
""" """
渲染字体样式 渲染字体样式
@ -226,7 +255,7 @@ class Basic:
return re.sub('// .*?\n', '\n', text) return re.sub('// .*?\n', '\n', text)
def add_indent_to_string(input_string: str, indent_spaces: int = 4): def indent(input_string: str, indent_spaces: int = 4):
""" """
给字符串中的每一行前面加上缩进 给字符串中的每一行前面加上缩进
:param input_string: 原始字符串可以包含多行 :param input_string: 原始字符串可以包含多行
@ -284,26 +313,12 @@ if __name__ == '__main__':
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>UTF-8编码示例</title> <title>UTF-8编码示例</title>
<script type="text/javascript" async {indent(HEAD)}
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<link href="https://cdn.jsdelivr.net/npm/prismjs/themes/prism.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/prismjs/prism.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs/components/prism-yaml.min.js"></script>
<style>
.block {{
background-color: grey; /* 灰色背景 */
color: white; /* 白色文字 */
}}
</style>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<!-- 可以在这里添加其他元数据和CSS链接 --> <!-- 可以在这里添加其他元数据和CSS链接 -->
</head> </head>
<body> <body>
<script> {indent(BODY)}
mermaid.initialize({{startOnLoad:true}}); {indent(cd, 4)}
</script>
{add_indent_to_string(cd, 4)}
</body> </body>
</html> </html>
""") """)

View File

@ -4,24 +4,31 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>UTF-8编码示例</title> <title>UTF-8编码示例</title>
<script type="text/javascript" async <script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"> src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
</script> </script>
<link href="https://cdn.jsdelivr.net/npm/prismjs/themes/prism.css" rel="stylesheet" /> <link href="https://cdn.jsdelivr.net/npm/prismjs/themes/prism.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/prismjs/prism.js"></script> <script src="https://cdn.jsdelivr.net/npm/prismjs/prism.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs/components/prism-yaml.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/prismjs/components/prism-yaml.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<style> <style>
.block { .block {
background-color: grey; /* 灰色背景 */ background-color: grey; /* 灰色背景 */
color: white; /* 白色文字 */ color: white; /* 白色文字 */
} }
</style> </style>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<!-- 可以在这里添加其他元数据和CSS链接 --> <!-- 可以在这里添加其他元数据和CSS链接 -->
</head> </head>
<body> <body>
<script> <script>
mermaid.initialize({startOnLoad:true}); mermaid.initialize({{startOnLoad:true}});
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
emojify.run();
});
</script> </script>
<div class="toc"> <div class="toc">
<ul> <ul>
@ -105,6 +112,7 @@
</li> </li>
<li><a href="#9">9 表格</a></li> <li><a href="#9">9 表格</a></li>
<li><a href="#10">10 警告</a></li> <li><a href="#10">10 警告</a></li>
<li><a href="#11-emoji">11 Emoji</a></li>
</ul> </ul>
</div> </div>
<hr /> <hr />
@ -266,5 +274,8 @@
<div class="admonition 这是一条警告"> <div class="admonition 这是一条警告">
<p class="admonition-title">这是一条警告</p> <p class="admonition-title">这是一条警告</p>
</div> </div>
<h1 id="11-emoji">11<span id="11"></span> Emoji</h1>
<p>:heart:</p>
<p>:smile:</p>
</body> </body>
</html> </html>

View File

@ -208,4 +208,11 @@ graph LR
| 单元格4 | 单元格5 | 单元格6 | | 单元格4 | 单元格5 | 单元格6 |
10 警告 10 警告
!!! 这是一条警告 !!! 这是一条警告
11 Emoji
:heart:
:smile:

View File

@ -1 +1,3 @@
markdown>=0 Markdown>=3.7
matplotlib>=3.9.2
numpy>=2.1.1