-
Notifications
You must be signed in to change notification settings - Fork 0
/
markdown.tmpl
194 lines (179 loc) · 7.28 KB
/
markdown.tmpl
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>{{.Title}}</title> {{/* index.html模板中的变量传递到header.html模板中使用 */}}
<meta name="keywords" content="{{.Keywords}}">
<meta name="description" content="{{.Description}}">
<link rel="stylesheet" href="/static/css/markdown.css"></link>
<link rel="stylesheet" href="/static/css/style.css"></link>
<link rel="icon" href="/static/favicons/favicon.svg">
<link rel="stylesheet" href="/static/css/katex/0.16.11/katex.min.css"></link>
<script src="/static/js/icons.js"></script>
<script defer src="/static/js/mermaid/11.3.0/mermaid.min.js"></script>
<script defer src="/static/js/katex/0.16.11/katex.min.js"></script>
<script defer src="/static/js/katex/0.16.11/auto-render.min.js"></script>
<script src="/static/js/d3/7.9.0/d3.v7.min.js"></script>
<script src="/static/js/popperjs/core/2.11.8/popper.min.js"></script>
<link rel="stylesheet" href="/static/css/cal-heatmap/4.2.4/cal-heatmap.css">
<script src="/static/js/cal-heatmap/4.2.4/cal-heatmap.min.js"></script>
<script src="/static/js/cal-heatmap/4.2.4/LegendLite.min.js"></script>
<script src="/static/js/cal-heatmap/4.2.4/Tooltip.min.js"></script>
<script src="/static/js/cal-heatmap/4.2.4/CalendarLabel.min.js"></script>
<script>
const cal = new CalHeatmap();
function calPrevious(e) {
e.preventDefault();
cal.previous();
}
function calNext(e) {
e.preventDefault();
cal.next();
}
// const calDataSource = [
// { date: '2024-10-01', value: 1 },
// ];
const calDataSource = {{.GitStatsData}}
const calData = {
data: {
source: calDataSource,
x: 'date',
y: 'value',
},
date: { start: new Date('{{.GitStartDate}}') },
range: 12,
scale: {
color: {
type: 'threshold',
range: ['#4dd05a','#37a446','#166b34','#14432a', ],
domain: [2, 5, 10],
},
},
domain: {
type: 'month',
gutter: 4,
label: { text: 'MMM', textAlign: 'start', position: 'top' },
},
subDomain: { type: 'ghDay', radius: 2, width: 11, height: 11, gutter: 4 },
itemSelector: '#cal-heatmap',
}
const calOpts = [
[Tooltip,
{
text: function (date, value, dayjsDate) {
return (
(value ? value : 'No') +
' contributions on ' +
dayjsDate.format('dddd, MMMM D, YYYY')
);
},
},
],
[LegendLite,
{
includeBlank: true,
itemSelector: '#cal-heatmap-legend',
radius: 2,
width: 11,
height: 11,
gutter: 4,
},
],
[CalendarLabel,
{
width: 30,
textAlign: 'start',
text: () => dayjs.weekdaysShort().map((d, i) => (i % 2 == 0 ? '' : d)),
padding: [25, 0, 0, 0],
},
],
];
document.addEventListener("DOMContentLoaded", function() {
cal.paint(calData, calOpts);
renderMathInElement(document.body, {
strict: "ignore",
trust: ["\\htmlId"],
delimiters: [{
left: "\\[",
right: "\\]",
display: true
}, {
left: "\\(",
right: "\\)",
display: false
},{
left: "$$",
right: "$$",
display: true
}, {
left: "$",
right: "$",
display: false
}],
macros: {
"\\eqref": "\\href{###1}{(\\text{#1})}",
"\\ref": "\\href{###1}{\\text{#1}}",
"\\label": "\\htmlId{#1}{}",
"\\f": "#1f(#2)"
},
throwOnError: false,
});
});
</script>
</head>
<body>
<header>
<div>
<div>
<a href="https://note.wcoder.com" target="_blank">
<span style="font-weight: 700; color: #15aabf; font-size: 2em;">
note.wcoder.com
</span>
</a>
</div>
<div>
<a href="https://wcoder.com/" target="_blank" style="font-weight: 500; font-size: 1.1em; color: #495057; padding: 0.5em 0.75em;">wcoder</a>
<a href="https://github.com/kingreatwill" target="_blank" style="font-weight: 500; font-size: 1.1em; color: #495057; padding: 0.5em 0.75em;">GitHub</a>
</div>
</div>
</header>
<div class="layout">
<div class="layout-sidebar">
<div class="path">
<a href="/"><img src="/static/icons/default_root_folder_opened.svg"/>Home</a>
{{if .UpperPath}} <a href="{{.UpperPath}}">../</a> {{end}}
</div>
<div>
<ul>
{{range .CurrentDirs}} {{/* 这种方式无法访问到index或者key的值,需要通过.来访问对应的value */}}
{{if .IsFile}}
<li class="page"><a href="{{.Href}}"><img src="/static/icons/default_file.svg" onload="this.onload=null; this.src=getFileIconPath('{{.FileExtension}}');"/>{{.Name}}</a></li>
{{else}}
<li class="folder"><a href="{{.Href}}"><img src="/static/icons/default_folder.svg" onload="this.onload=null; this.src=getFolderIconPath('{{.FileExtension}}');"/>{{.Name}}</a></li>
{{end}}{{end}}
</ul>
</div>
</div><!--end of layout-sidebar-->
<div class="layout-main">
<div class="markdown">{{.MdHtml}}</div>
</div><!--end of layout-main-->
</div><!--end of layout-->
<div style="color: #adbac7; border-radius: 3px; padding: 1rem; overflow: hidden; max-width: 58em;">
<div id="cal-heatmap" class="margin-bottom--md"></div>
<a style="display: display;" class="button button--sm button--secondary margin-top--sm" href="#" onclick="calPrevious(event)">
← Previous
</a>
<a style="display: display;" class="button button--sm button--secondary margin-top--sm margin-left--xs" href="#" onclick="calNext(event)">
Next →
</a>
<div style="float: right; font-size: 12px;">
<span style="color: #768390">Less</span>
<div id="cal-heatmap-legend" style="display: inline-block; margin: 0px 4px;"></div>
<span style="color: #768390; font-size: 12px;">More</span>
</div>
</div>
<footer>
Served with <a rel="noopener noreferrer" href="https://github.com/kingreatwill/caddy-modules">caddy markdown</a>
</footer>
</body>
</html>