Compare commits

..

2 Commits

Author SHA1 Message Date
laishunchao 7607fb89a9 feat: 添加数学公式的解析 2025-04-15 11:49:19 +08:00
laishunchao 580f442c57 chore: 文件结构调整 2025-04-15 11:13:40 +08:00
8 changed files with 29 additions and 70 deletions

8
.idea/.gitignore vendored
View File

@ -1,8 +0,0 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/anki-md-template.iml" filepath="$PROJECT_DIR$/.idea/anki-md-template.iml" />
</modules>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -16,17 +16,15 @@
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"
/>
<!-- 添加MathJax配置 -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [['$','$']],
displayMath: [['$$','$$']],
processEscapes: true
}
});
</script>
<title>anki-md模板测试</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/markdown-it-texmath@1.0.0/css/texmath.min.css"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css"
/>
<title>anki-md模板测试chrome等浏览器开发测试即可</title>
</head>
<style>
.markdown-body {
@ -54,15 +52,19 @@
</div>
<!-- prettier-ignore -->
<div class="md-content">
这是一个行内公式
$$E=mc^2$$
和一个块级公式
$$\\frac{d}{dx}(x^n) = nx^{n-1}$$
行内公式:$E=mc^2$
***
块级公式:
$$\frac{d}{dx}(x^n) = nx^{n-1}$$
***
矩阵:
$$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$$
***
积分:
$$\int_{a}^{b} f(x) \, dx$$
***
> 呵呵呵
> 喜喜
# 一级标题
## 二级标题
### 三级标题
@ -74,12 +76,8 @@ $$\\frac{d}{dx}(x^n) = nx^{n-1}$$
> 引用
---
- 无序列表
- 无序列表
- 无序列表
---
1. 有序列表
2. 有序列表
3. 有序列表
---
[链接](https://www.baidu.com)
---
@ -101,14 +99,12 @@ console.log('hello world')
getScript(
"https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/highlight.js/11.4.0/highlight.min.js"
),
// 添加markdown-it-texmath插件
getScript(
"https://cdn.jsdelivr.net/npm/markdown-it-texmath/texmath.min.js"
"https://cdn.jsdelivr.net/npm/markdown-it-texmath@1.0.0/texmath.min.js"
),
// 添加MathJax
getScript(
"https://cdn.bootcdn.net/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.min.js"
)
"https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.js"
),
];
// 加载资源并初始化
@ -172,16 +168,11 @@ console.log('hello world')
return ""; // use external default escaping
},
});
// 配置markdown-it-texmath插件
if (window.texmath) {
md.use(window.texmath, {
engine: MathJax,
delimiters: 'dollars',
katexOptions: { macros: {"\\RR": "\\mathbb{R}"} }
md.use(texmath, {
engine: katex,
delimiters: "dollars",
katexOptions: { macros: { "\\RR": "\\mathbb{R}" } },
});
}
document.querySelectorAll(".md-content").forEach((div, index) => {
console.log("查找到的容器元素", div);
// 需要去除首尾空格 不然markdown-it会解析错误

View File

@ -1,6 +1,8 @@
@import url('https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.8.1/github-markdown.min.css');
@import url('https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/base16/onedark.min.css');
@import url('https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css');
@import url('https://cdn.jsdelivr.net/npm/markdown-it-texmath@1.0.0/css/texmath.min.css');
@import url('https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css');
/*
把这里的样式代码 ctrl a 复制到卡片模板 的样式区域
*/