-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
66 lines (62 loc) · 1.81 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
<!DOCTYPE html>
<html>
<head>
<meta content="width=device-width" name="viewport">
<meta charset="utf-8">
<title>Line Number Plugin for Highlight.js</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" rel="stylesheet">
</head>
<body>
<header>
<h1>Line Number Plugin for <a href="https://highlightjs.org" rel="nofollow" target="_blank">Highlight.js</a></h1>
<p>Works for all themes. No configuration needed. Number and border color will inherit to your theme color.</p>
</header>
<main>
<h2>CSS</h2>
<pre><code class="hljs language-css">* {
box-sizing: border-box;
color: inherit;
font: inherit;
margin: 0;
padding: 0;
}
:root {
background: #fff;
color: #000;
font: normal normal 16px/1.4 sans-serif;
}
body {
padding: 2em;
}
#main {
margin: 0 auto;
max-width: 600px;
}</code></pre>
<h2>HTML</h2>
<pre><code class="hljs language-html"><main id="main">
<p>
Loading&hellip;
</p>
</main></code></pre>
<h2>JavaScript</h2>
<pre><code class="hljs language-js">let controller = new AbortController;
fetch('https://example.com/rest/index.json', {
signal: controller.signal
}).then(response => response.json()).then(json => {
let out = "";
for (let v of json) {
out += '<article>';
out += '<h2>' + v.title + '</h2>';
out += '<p>' + v.description + '</p>';
out += '</article>';
}
document.querySelector('#main').innerHTML = out;
});</code></pre>
</main>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="index.min.js"></script>
<script>
hljs.highlightAll();
</script>
</body>
</html>