-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtemplate.html
115 lines (96 loc) · 4.47 KB
/
template.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
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
<!doctype html>
<html lang="en" class="h-100" data-bs-theme="light">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="generator" content="pandoc">
$if(author)$<meta name="author" content="$author$">$endif$
$if(description)$<meta name="description" content="$description$">$endif$
$if(title)$<title>$title$</title>$endif$
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<!-- Bootstrap Icon -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" integrity="sha384-tViUnnbYAV00FLIhhi3v/dWt3Jxw4gZQcNoSCxCIFNJVCx7/D55/wXsrNIRANwdD" crossorigin="anonymous">
<!-- Highlight.js Styles -->
<link rel="stylesheet" id="highlight-style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/styles/stackoverflow-light.min.css">
<!-- Custom Styles -->
<link rel="stylesheet" href="https://getbootstrap.com/docs/5.3/assets/css/docs.css">
<link rel="stylesheet" href="styles.css">
<!-- After header contents -->
$for(header-includes)$
$header-includes$
$endfor$
</head>
<body class="d-flex flex-column h-100" data-bs-spy="scroll" data-bs-target="#TableOfContents">
<!-- Before body contents -->
$for(include-before)$
$include-before$
$endfor$
<div class="container-xxl bd-gutter bd-layout mb-5">
<main class="bd-main order-1">
<!-- Tiltle -->
$if(title)$<h1 class="bd-intro ps-lg-2 pt-2" id="title">$title$</h1>$endif$
$if(toc)$
<!-- Table of Contents -->
<div class="bd-toc mt-lg-0 mb-lg-5 mt-3 mb-5 px-sm-1 text-body-secondary">
<strong class="d-md-block d-none h6 my-2 ms-3">On this page</strong>
<hr class="d-md-block d-none my-2 ms-3">
<div class="collapse bd-toc-collapse" id="tocContents">
<nav id="TableOfContents">
$toc$
</nav>
</div>
</div>
$endif$
<!-- Main Content -->
<div class="bd-content ps-lg-2">
$body$
</div>
</main>
</div>
<!-- After body contents -->
$for(include-after)$
$include-after$
$endfor$
<!-- Bootstrap Bundle -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<!-- Highlight.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/highlight.min.js" integrity="sha512-6yoqbrcLAHDWAdQmiRlHG4+m0g/CT/V9AGyxabG8j7Jk8j3r3K6due7oqpiRMZqcYe9WM2gPcaNNxnl2ux+3tA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
$if(mathjax)$
<!-- Mathjax -->
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
$endif$
<!-- Custom Scripts -->
<script>
document.addEventListener("DOMContentLoaded", () => {
const htmlElement = document.documentElement;
const highlightStyle = document.getElementById("highlight-style");
// Function to update Highlight.js style based on theme
const updateHighlightStyle = (theme) => {
const lightTheme = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/styles/stackoverflow-light.min.css";
const darkTheme = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/styles/github-dark.min.css";
highlightStyle.href = theme === "dark" ? darkTheme : lightTheme;
};
// Function to set the theme
const setTheme = (theme) => {
htmlElement.setAttribute("data-bs-theme", theme);
localStorage.setItem("theme", theme); // Save the theme to localStorage
updateHighlightStyle(theme);
};
// Get saved theme from localStorage or fallback to default ("light")
const savedTheme = localStorage.getItem("theme") || "light";
setTheme(savedTheme);
// Event listener for theme dropdown
document.querySelectorAll(".dropdown-item").forEach((item) => {
item.addEventListener("click", (e) => {
e.preventDefault();
const selectedTheme = item.getAttribute("data-theme");
setTheme(selectedTheme);
});
});
// Initialize Highlight.js
hljs.highlightAll();
});
</script>
</body>
</html>