-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
232 lines (198 loc) · 6.48 KB
/
index.html
File metadata and controls
232 lines (198 loc) · 6.48 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
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!doctype html>
<html lang="en" data-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Reference materials for Xextan, the compact logical language">
<link rel="shortcut icon" type="image/png" href="assets/user/xex_heart.png"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/picocss/1.4.4/pico.min.css" integrity="sha512-RAtoAGzPS5T5sUpCfVpkY5EHHDcqEp26rHYNee0Vx4RT1pxJrt3CWQCVD/ekrPdMowT4ybxYvqClqf9v7oWxYw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" id="highlight-styles">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.4.0/highlight.min.js" integrity="sha512-IaaKO80nPNs5j+VLxd42eK/7sYuXQmr+fyywCNA0e+C6gtQnuCXNtORe9xR4LqGPz5U9VpH+ff41wKs/ZmC3iA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js" integrity="sha512-L03kznCrNOfVxOUovR6ESfCz9Gfny7gihUX/huVbQB9zjODtYpxaVtIaAkpetoiyV2eqWbvxMH9fiSv5enX7bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<title>Xextan Reference Guide</title>
<style>
/**** pico style overrides *****/
/* link underlines for a11y */
a {
text-decoration: underline;
}
/* focus indicator for a11y */
[data-theme="dark"] a:focus {
outline: 2px solid rgba(225,225,225,0.5);
border-radius: 2px;
}
[data-theme="light"] a:focus {
outline: 2px solid rgba(25,25,25,0.5);
border-radius: 2px;
}
/* adjust contain widths */
@media (max-width: 1199px) {
.container {
max-width: 100%;
padding-left: 30px;
padding-right: 30px;
}
}
@media (max-width: 575px) {
.container {
padding-left: 16px;
padding-right: 16px;
}
}
/* adjust heading margins */
h2 {
margin-bottom: 1.5rem;
}
/* dark/light mode toggle button */
#light-toggle {
position: absolute;
top: 10px;
right: 10px;
padding: 5px;
font-size: 14px;
font-weight: 500;
}
/* increase color contrast for a11y */
:root {
--primary: #13b1e5 !important;
}
#insert a {
background-color: transparent;
}
[data-theme="light"] a {
color: #0c779a;
}
[data-theme="light"] code {
color: rgb(80, 105, 115);
}
[data-theme="dark"] code {
color: rgb(135, 150, 160);
}
[data-theme="light"] pre code {
color: initial;
}
[data-theme="dark"] pre code {
color: initial;
}
[data-theme="light"] a code {
color: #80556b !important;
}
[data-theme="dark"] a code {
color: #b77a99 !important;
}
[data-theme="light"] .hljs {
background: #fcfcfc;
}
[data-theme="dark"] .hljs {
background: #0d1418;
}
[data-theme="light"] .hljs-comment, .hljs-deletion, .hljs-meta {
color: #555;
}
[data-theme="dark"] .hljs-comment, .hljs-deletion, .hljs-meta {
color: #ccc;
}
</style>
</head>
<body>
<main role="main" class="container">
<a href="#" role="button" onclick="toggleLight();return false;" id="light-toggle" class="contrast">🌗 Light</a>
<div id="insert"></div>
</main>
<script type="text/javascript">
// set syntax highlighting theme based on light or dark mode
function setHighlightTheme(mode) {
var link = document.getElementById('highlight-styles');
if (mode == "light") {
link.href = 'https://unpkg.com/@highlightjs/cdn-assets@11.4.0/styles/a11y-light.min.css';
}
if (mode == "dark") {
link.href = 'https://unpkg.com/@highlightjs/cdn-assets@11.4.0/styles/monokai-sublime.min.css';
}
}
// toggle between light and dark mode
function toggleLight() {
var mode = localStorage.getItem("mode");
if (mode == "light") {
document.documentElement.setAttribute("data-theme", "dark");
document.getElementById('light-toggle').innerHTML = "🌗 Light";
document.getElementById('light-toggle').style.color = "#333";
localStorage.setItem("mode", "dark");
setHighlightTheme("dark");
}
if (mode == "dark" || mode == null) {
document.documentElement.setAttribute("data-theme", "light");
document.getElementById('light-toggle').innerHTML = "🌗 Dark";
document.getElementById('light-toggle').style.color = "#ddd";
localStorage.setItem("mode", "light");
setHighlightTheme("light");
}
}
// helper function to grab query string value
function getParameterByName(name, url = window.location.href) {
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
// build URL for markdown file
var page = getParameterByName('page');
if (page) {
page = "pages/" + page + ".md"
} else {
page = "README.md";
}
// request markdown file
var client = new XMLHttpRequest();
client.open('GET', page);
client.onreadystatechange = function() {
if (client.readyState == 4 && client.status == 200) {
if (client.responseText) {
var div = document.getElementById('insert');
div.innerHTML += client.responseText;
var conv = new showdown.Converter();
conv.setOption('tables', 'true');
conv.setOption('emoji', 'true');
conv.setOption('ghCompatibleHeaderId', 'true');
conv.setOption('simpleLineBreaks', 'true');
conv.setOption('strikethrough', 'true');
conv.setOption('tasklists', 'true');
conv.setOption('parseImgDimensions', 'true');
//conv.setOption('ghCodeBlocks', 'true');
//conv.setOption('openLinksInNewWindow', 'true');
// convert markdown to HTML
document.getElementById('insert').innerHTML = conv.makeHtml(div.textContent);
// set title as first h1 plus site title
var h1s = document.getElementsByTagName("h1");
for (var i = 0; i < h1s.length; i++) {
var h1 = h1s[i];
document.title = h1.innerText + " | " + document.title;
}
// apply syntax highlighting for code blocks
hljs.highlightAll();
// jump to anchor if present
var hash = window.location.hash;
if (hash && document.getElementById(hash.substring(1))) {
document.getElementById(hash.substring(1)).scrollIntoView();
}
}
}
}
client.send();
// get current light/dark mode on page load
(function () {
var mode = localStorage.getItem("mode");
if (mode == "light") {
document.documentElement.setAttribute("data-theme", "light");
document.getElementById('light-toggle').innerHTML = "🌗 Dark";
document.getElementById('light-toggle').style.color = "#ddd";
setHighlightTheme("light");
} else {
setHighlightTheme("dark");
}
})();
</script>
</body>
</html>