-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
71 lines (64 loc) · 1.87 KB
/
index.html
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>rxgitcid demo</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js" id="rxcornor"
link="https://github.com/cheere/rxgitcid" target="_blank"></script>
<!-- 用于加载 README.md -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/marked.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/default.min.css">
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
</head>
<body>
<h1>rxgitcid</h1>
<p>Get the commit <b>ID</b> of the last commit of git.</p>
<br>
<hr>
<div id='content'></div>
<!-- 加载 md -->
<script type="text/javascript">
$(function () {
$.ajax({
url: 'README.md',
dataType: 'text',
success: function (data) {
document.getElementById('content').innerHTML = marked.parse(data)
addColor()
}
});
});
</script>
<script>
marked.setOptions({
renderer: new marked.Renderer(),
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false,
highlight: function (code, lang) {
//使用 highlight 插件解析文档中代码部分
return hljs.highlightAuto(code, [lang]).value;
}
});
</script>
<script>
function addColor() {
setTimeout(() => {
preCodeTohljs()
}, 200);
}
function preCodeTohljs() {
const code = $('pre').find('code')
code.each(function () {
$(this).addClass('hljs')
})
}
</script>
</body>
</html>