-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnote.html
More file actions
45 lines (42 loc) · 2.13 KB
/
note.html
File metadata and controls
45 lines (42 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>课程笔记</title>
<link rel="stylesheet" href="styles.css">
<script src="https://cdn.jsdelivr.net/npm/showdown/dist/showdown.min.js"></script>
<!-- 在这里添加KaTeX -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.js" integrity="sha384-2BKqo+exmr9su6dir+qCw08N2ZKRucY4PrGQPPWU1A7FtlCGjmEGFqXCv5nyM5Ij" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
<!-- 在这里添加MathJax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-mml-chtml.js"></script>
</head>
<body>
<div class="note-container">
<div class="note-content" id="content">Loading...</div>
</div>
<script>
// 获取URL中的章节和小节参数
const urlParams = new URLSearchParams(window.location.search);
const chapter = urlParams.get('c');
const section = urlParams.get('s');
// 生成对应的 Markdown 文件路径
const markdownFile = `notes/c${chapter}_s${section}.md`;
// 加载并显示笔记内容
const converter = new showdown.Converter();
fetch(markdownFile)
.then(response => response.text())
.then(text => {
const html = converter.makeHtml(text);
document.getElementById('content').innerHTML = html;
})
.catch(error => {
console.error('Error loading the markdown file:', error);
document.getElementById('content').innerText = 'Error loading note: ' + error.message;
});
</script>
</body>
</html>