1.9.3 优化

This commit is contained in:
跨越晨昏 2024-10-15 19:21:26 +08:00
parent 002d79a3b6
commit ca2d97daf6
3 changed files with 17 additions and 28 deletions

View File

@ -6,7 +6,6 @@ __all__ = [
'main', # 主函数
'indent', # 添加空格
'HEAD', #
'BODY', #
]
__version__ = '0.11.2'
__author__ = 'CrossDark'
@ -15,28 +14,22 @@ __source__ = 'https://crossdark.net/'
__license__ = """MIT"""
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>', # 渲染latex
HEAD = {
('latex', 'js'): '<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"></script>',
# mermaid
'<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>',
'<script>',
' mermaid.initialize({startOnLoad:true});',
'</script>',
('mermaid', 'js'): '<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>',
('mermaid', 'init'): '<script>mermaid.initialize({startOnLoad:true})</script>',
'<link rel="stylesheet" href="../Static/styles.css">', # 代码高亮css
('code-highlight', 'css'): '<link rel="stylesheet" href="../Static/styles.css">', # 代码高亮css
'<style>', # 强调css
' .block {',
' background-color: grey; /* 灰色背景 */',
' color: white; /* 白色文字 */',
'}',
'</style>'
)
BODY = (
'',
)
('block', 'css'): """<style>
.block {
background-color: grey; /* 灰色背景 */
color: white; /* 白色文字 */
}
</style>"""
}
def indent(input_: Union[str, List, Tuple], indent_spaces: int = 4) -> str:

View File

@ -6,9 +6,7 @@
<title>UTF-8编码示例</title>
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<script>
mermaid.initialize({startOnLoad:true});
</script>
<script>mermaid.initialize({startOnLoad:true})</script>
<link rel="stylesheet" href="../Static/styles.css">
<style>
.block {
@ -19,7 +17,6 @@
<!-- 可以在这里添加其他元数据和CSS链接 -->
</head>
<body>
<div class="toc">
<ul>
<li><a href="#crossdown">CrossDown</a></li>

3
run.py
View File

@ -20,11 +20,10 @@ if __name__ == '__main__':
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>UTF-8编码示例</title>
{indent(HEAD)}
{indent(list(HEAD.values()))}
<!-- 可以在这里添加其他元数据和CSS链接 -->
</head>
<body>
{indent(BODY)}
{indent(cd, 4)}
</body>
</html>