Merge pull request 'V1' (#2) from V1 into main

Reviewed-on: crossdark/CrossDown#2
This commit is contained in:
跨越晨昏 2024-10-15 22:09:48 +08:00
commit 38e4d4cb41
5 changed files with 78 additions and 40 deletions

View File

@ -6,7 +6,6 @@ __all__ = [
'main', # 主函数
'indent', # 添加空格
'HEAD', #
'BODY', #
]
__version__ = '0.11.2'
__author__ = 'CrossDark'
@ -15,36 +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>',
'<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>',
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>',
# Highlight.js
# '<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/styles/default.min.css">',
# '<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/highlight.min.js"></script>',
# '<script>hljs.highlightAll();</script>',
('code-highlight', 'css'): '<link rel="stylesheet" href="../Static/styles.css">', # 代码高亮css
'<link rel="stylesheet" href="../Static/styles.css">',
'<style>',
' .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

@ -5,24 +5,18 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<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>
<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>
<script>
mermaid.initialize({startOnLoad:true});
</script>
<script>mermaid.initialize({startOnLoad:true})</script>
<link rel="stylesheet" href="../Static/styles.css">
<style>
.block {
background-color: grey; /* 灰色背景 */
color: white; /* 白色文字 */
.block {
background-color: grey; /* 灰色背景 */
color: white; /* 白色文字 */
}
</style>
<!-- 可以在这里添加其他元数据和CSS链接 -->
</head>
<body>
<div class="toc">
<ul>
<li><a href="#crossdown">CrossDown</a></li>
@ -86,6 +80,7 @@
<li><a href="#4.2.2">4.2.2 Python</a></li>
<li><a href="#4.2.3">4.2.3 Mermaid</a></li>
<li><a href="#4.2.4">4.2.4 shell</a></li>
<li><a href="#4.2.5">4.2.5 latex</a></li>
</ul>
</li>
</ul>
@ -213,6 +208,33 @@
<div class="codehilite"><pre><span></span><code class="shell"><span class="nb">cd</span><span class="w"> </span>../..
</code></pre></div>
<h3 id="4.2.5">4.2.5 latex</h3>
<div class="codehilite"><pre><span></span><code class="latex"><span class="k">\documentclass</span><span class="nb">{</span>article<span class="nb">}</span>
<span class="k">\title</span><span class="nb">{</span>我的第一个LaTeX文档<span class="nb">}</span>
<span class="k">\author</span><span class="nb">{</span>作者姓名<span class="nb">}</span>
<span class="k">\date</span><span class="nb">{</span><span class="k">\today</span><span class="nb">}</span>
<span class="k">\begin</span><span class="nb">{</span>document<span class="nb">}</span>
<span class="k">\maketitle</span>
这是我的第一个LaTeX文档。它包含了一个标题、作者信息、日期和一个简单的正文部分。
<span class="k">\section</span><span class="nb">{</span>引言<span class="nb">}</span>
这是引言部分,可以简要介绍文档的主题和目的。
<span class="k">\section</span><span class="nb">{</span>正文<span class="nb">}</span>
这是正文部分,可以详细阐述你的观点或研究内容。你可以根据需要添加更多的章节和子章节。
<span class="k">\subsection</span><span class="nb">{</span>子章节示例<span class="nb">}</span>
这是一个子章节的示例用于展示如何在LaTeX文档中创建层次结构。
<span class="k">\end</span><span class="nb">{</span>document<span class="nb">}</span>
</code></pre></div>
<h1 id="5">5 转义</h1>
<p>\ </p>
<p>\a </p>

View File

@ -151,6 +151,35 @@ graph TD
cd ../..
```
4.2.5 latex
```latex
\documentclass{article}
\title{我的第一个LaTeX文档}
\author{作者姓名}
\date{\today}
\begin{document}
\maketitle
这是我的第一个LaTeX文档。它包含了一个标题、作者信息、日期和一个简单的正文部分。
\section{引言}
这是引言部分,可以简要介绍文档的主题和目的。
\section{正文}
这是正文部分,可以详细阐述你的观点或研究内容。你可以根据需要添加更多的章节和子章节。
\subsection{子章节示例}
这是一个子章节的示例用于展示如何在LaTeX文档中创建层次结构。
\end{document}
```
5 转义
\\

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>

View File

@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools.setup(
name="CrossDown",
version="1.0.1",
version="2.0.0",
author="CrossDark",
author_email="liuhanbo333@icloud.com",
description="CrossDark's MarkDown",
@ -18,6 +18,9 @@ setuptools.setup(
'matplotlib',
'numpy',
],
package_data={
'': ['static/*'], # 这将包含static文件夹下的所有子文件夹和文件
},
classifiers=[
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',