-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.html
81 lines (74 loc) · 3 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>$title</title>
<script src="https://www.w3.org/Tools/respec/respec-w3c" class="remove" defer></script>
<!-- syntax highlighting -->
<script class='remove'>
async function loadRust() {
//this is the function you call in 'preProcess', to load the highlighter
const worker = await new Promise(resolve => {
require(["core/worker"], ({ worker }) => resolve(worker));
});
const action = "highlight-load-lang";
const langURL =
"https://gistcdn.githack.com/mimoo/a9e28fc565dddb369477e8bd34e6a1ae/raw/d8a7057fe9c7140f7ef5972b333716d9933fa29b/hljs-rust.js";
const propName = "hljsDefineRust"; // This funtion is defined in the highlighter being loaded
const lang = "language-rust"; // this is the class you use to identify the language
worker.postMessage({ action, langURL, propName, lang });
return new Promise(resolve => {
worker.addEventListener("message", function listener({ data }) {
const { action: responseAction, lang: responseLang } = data;
if (responseAction === action && responseLang === lang) {
worker.removeEventListener("message", listener);
resolve();
}
});
});
}
async function loadPython() {
const worker = await new Promise(resolve => {
require(["core/worker"], ({ worker }) => resolve(worker));
});
const action = "highlight-load-lang";
const langURL =
"https://gistcdn.githack.com/mimoo/fd9652b0c0d64bfc9f8cae69c72030b1/raw/2315322f87ba81c92c22477a05da6c4181f02df2/respec-py.js"; // URL to Python highlighter
const propName = "hljsDefinePython"; // Adjust this if needed
const lang = "language-py";
worker.postMessage({ action, langURL, propName, lang });
return new Promise(resolve => {
worker.addEventListener("message", function listener({ data }) {
if (data.action === action && data.lang === lang) {
worker.removeEventListener("message", listener);
resolve();
}
});
});
}
var respecConfig = {
preProcess: [loadRust, loadPython],
specStatus: "unofficial",
latestVersion: null,
license: "cc0",
editors: [
{
name: "$editor",
url: "https://www.zksecurity.xyz",
},
],
github: "zksecurity/RFCs",
shortName: "$shortName",
};
</script>
</head>
<body>
<section id="abstract">
<p>$abstract</p>
</section>
<section id="sotd">
<p>$sotd</p>
</section>
$spec
</body>
</html>