jekyll-theme-simplix 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/404.md +9 -0
- data/LICENSE +121 -0
- data/README.md +129 -0
- data/_includes/footer.html +1 -0
- data/_includes/head.html +40 -0
- data/_includes/list-group.html +8 -0
- data/_includes/list-post.html +36 -0
- data/_includes/ui.html +22 -0
- data/_layouts/archive.html +6 -0
- data/_layouts/default.html +36 -0
- data/_layouts/home.html +21 -0
- data/_layouts/page.html +14 -0
- data/_layouts/post.html +52 -0
- data/_sass/abcjs.scss +116 -0
- data/_sass/main.scss +767 -0
- data/_sass/rouge.scss +168 -0
- data/_sass/theme.scss +197 -0
- data/assets/script.js +201 -0
- data/assets/style.scss +19 -0
- data/posts.html +23 -0
- metadata +22 -2
data/_sass/rouge.scss
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
.c, .c1, .cm, .cp, .cpf, .cs, .ge, .ges, .sd {
|
|
2
|
+
font-style: italic;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.ges, .gh, .gs, .gu, .k, .kc, .kd, .kn, .kp, .kr, .kt, .nb {
|
|
6
|
+
font-weight: bold;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.gh {
|
|
10
|
+
text-decoration: underline;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.hll {
|
|
14
|
+
background: #faf7b3;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.language-diff {
|
|
18
|
+
.err, .gr {
|
|
19
|
+
background: none !important;
|
|
20
|
+
color: inherit;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.language-md, .language-markdown {
|
|
25
|
+
.sx {
|
|
26
|
+
text-decoration: 1px underline;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@mixin rouge-light {
|
|
31
|
+
pre code {
|
|
32
|
+
color: #2b2c28;
|
|
33
|
+
|
|
34
|
+
pre.lineno {
|
|
35
|
+
color: #81868f;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.err, .gr {
|
|
39
|
+
background: #ef3722;
|
|
40
|
+
color: #fff;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.c, .c1, .cm, .cs, .sd, .sh {
|
|
44
|
+
color: #b7a1e7;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.cp, .cpf {
|
|
48
|
+
color: #c99d91;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.gd, .gr, .ne {
|
|
52
|
+
color: #ef3722;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.gi {
|
|
56
|
+
color: #188a5b;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.gp {
|
|
60
|
+
color: #b7a1e7;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.il, .ld, .m, .mf, .mh, .mi, .mo {
|
|
64
|
+
color: #6dacf8;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.k, .kd, .kn, .kr, .nb, .o, .ow, .p, .pi, .se, .sr, .ss {
|
|
68
|
+
color: #8f61b7;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.kc, .kp, .kt {
|
|
72
|
+
color: #6cb6aa;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.l, .s, .s1, .s2, .sb, .sc, .sx {
|
|
76
|
+
color: #188a5b;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.na, .nl, .py {
|
|
80
|
+
color: #476f95;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.nc, .nn, .no, .nv, .si, .vc, .vg, .vi, .vm {
|
|
84
|
+
color: #b32987;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.nf, .ni {
|
|
88
|
+
color: #ff8531;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.nd {
|
|
92
|
+
color: #877982;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.nt {
|
|
96
|
+
color: #632fb4;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@mixin rouge-dark {
|
|
102
|
+
pre code {
|
|
103
|
+
pre.lineno {
|
|
104
|
+
color: #636d75;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.err, .gr {
|
|
108
|
+
background: #ef3722;
|
|
109
|
+
color: #fff;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.c, .c1, .cm, .cs, .sd, .sh {
|
|
113
|
+
color: #757480;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.cp, .cpf {
|
|
117
|
+
color: #fbdcca;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.gd, .gr, .ne {
|
|
121
|
+
color: #e58173;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.gi {
|
|
125
|
+
color: #43d78e;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.gp {
|
|
129
|
+
color: #b7a1e7;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.il, .ld, .m, .mf, .mh, .mi, .mo {
|
|
133
|
+
color: #87c3ed;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.k, .kd, .kn, .kr, .nb, .o, .ow, .p, .pi, .se, .sr, .ss {
|
|
137
|
+
color: #b5a5e0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.kc, .kp, .kt {
|
|
141
|
+
color: #4ca0b5;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.l, .s, .s1, .s2, .sb, .sc, .sx {
|
|
145
|
+
color: #a3d6c8;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.na, .nl, .py {
|
|
149
|
+
color: #4ec189;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.nc, .nn, .no, .nv, .si, .vc, .vg, .vi, .vm {
|
|
153
|
+
color: #e0bfff;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.nf, .ni {
|
|
157
|
+
color: #fab4a7;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.nd {
|
|
161
|
+
color: #976d5e;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.nt {
|
|
165
|
+
color: #8b75ec;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
data/_sass/theme.scss
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
$fade: .7;
|
|
2
|
+
$quote-alert: note tip important warning caution;
|
|
3
|
+
$quote-color-light: #44acff #ffce2e #b153d7 #ff8b5a #ff4400;
|
|
4
|
+
$quote-color-dark: #7ab9f0 #fff370 #de76eb #ffa95a #fa7070;
|
|
5
|
+
$quote-icon: "\e2ce" "\e2dc" "\e15c" "\e4e0" "\e9b8";
|
|
6
|
+
|
|
7
|
+
@mixin quote($name, $color, $icon) {
|
|
8
|
+
&.quote__alert-#{$name} {
|
|
9
|
+
border-color: #{$color} !important;
|
|
10
|
+
|
|
11
|
+
> p.quote__alert-title {
|
|
12
|
+
color: #{$color};
|
|
13
|
+
font-weight: bold;
|
|
14
|
+
|
|
15
|
+
&::before {
|
|
16
|
+
content: str-insert($icon, " ", 2);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@mixin theme-light {
|
|
23
|
+
$bg: white;
|
|
24
|
+
|
|
25
|
+
background: $bg;
|
|
26
|
+
|
|
27
|
+
&.main__bg-fill .home__content, &.main__bg-fill .post__content {
|
|
28
|
+
background: rgba($bg, $fade);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.page__header {
|
|
32
|
+
border-bottom: 1px solid #ddd;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[role="main"] {
|
|
36
|
+
h1, h2 {
|
|
37
|
+
border-bottom: 1px solid #ddd;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
blockquote {
|
|
41
|
+
border: 1px solid #ddd;
|
|
42
|
+
@for $i from 1 through length($quote-alert) {
|
|
43
|
+
@include quote(nth($quote-alert, $i), nth($quote-color-light, $i), nth($quote-icon, $i));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
hr {
|
|
48
|
+
background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA4MDAgMzIiPjxwYXRoIGQ9Ik0wIDE1aDM2OHYySDBabTQzMiAwaDM2OHYySDQzMloiLz48Y2lyY2xlIGN4PSI0MDAiIGN5PSI4IiByPSI0Ii8+PGNpcmNsZSBjeD0iMzkyIiBjeT0iMjQiIHI9IjQiLz48Y2lyY2xlIGN4PSI0MDgiIGN5PSIyNCIgcj0iNCIvPjwvc3ZnPg==") no-repeat center;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
table:not(.rouge-table) {
|
|
52
|
+
th {
|
|
53
|
+
border-bottom: 2px solid #aaa !important;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
th, td {
|
|
57
|
+
border: 1px solid #888;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
th, tr:nth-child(even of :has(td)) td {
|
|
61
|
+
background: #e9ecef5d;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
pre {
|
|
66
|
+
background: #f1f3f58d;
|
|
67
|
+
border: 1px solid #ddd;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.post__header > p a, [role="main"] a, footer a {
|
|
72
|
+
color: #444;
|
|
73
|
+
text-decoration: underline 1px solid #444;
|
|
74
|
+
|
|
75
|
+
&:visited {
|
|
76
|
+
color: #b136e2;
|
|
77
|
+
text-decoration: #b136e2;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&.footnote, &.reversefootnote {
|
|
81
|
+
color: #1975d2;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:not(.main__bg_fill) footer {
|
|
86
|
+
border-top: 1px solid #ddd;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&.main__bg-fill footer {
|
|
90
|
+
border-top: none;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.btn__theme-toggle {
|
|
94
|
+
border: 2px solid #6bc4ff;
|
|
95
|
+
|
|
96
|
+
span.btn__theme-toggle-light {
|
|
97
|
+
background: #1e91d6;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.btn__scroll-up button {
|
|
102
|
+
border: 1px solid #a6c8ff;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@mixin theme-dark {
|
|
107
|
+
$bg: #242124;
|
|
108
|
+
|
|
109
|
+
background: $bg;
|
|
110
|
+
color: #f0ffff;
|
|
111
|
+
|
|
112
|
+
&.main__bg-fill .home__content, &.main__bg-fill .post__content {
|
|
113
|
+
background: rgba($bg, $fade);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.page__header {
|
|
117
|
+
border-bottom: 1px solid #444;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
[role="main"] {
|
|
121
|
+
h1, h2 {
|
|
122
|
+
border-bottom: 1px solid #444;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
blockquote {
|
|
126
|
+
border: 1px solid #444;
|
|
127
|
+
@for $i from 1 through length($quote-alert) {
|
|
128
|
+
@include quote(nth($quote-alert, $i), nth($quote-color-dark, $i), nth($quote-icon, $i));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
hr {
|
|
133
|
+
background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA4MDAgMzIiPjxwYXRoIGQ9Ik0wIDE1aDM2OHYySDBabTQzMiAwaDM2OHYySDQzMloiIGZpbGw9IiNhYWEiLz48Y2lyY2xlIGN4PSI0MDAiIGN5PSI4IiByPSI0IiBmaWxsPSIjYWFhIi8+PGNpcmNsZSBjeD0iMzkyIiBjeT0iMjQiIHI9IjQiIGZpbGw9IiNhYWEiLz48Y2lyY2xlIGN4PSI0MDgiIGN5PSIyNCIgcj0iNCIgZmlsbD0iI2FhYSIvPjwvc3ZnPg==") no-repeat center;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
table:not(.rouge-table) {
|
|
137
|
+
th {
|
|
138
|
+
border-bottom: 2px solid #ddd !important;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
th, td {
|
|
142
|
+
border: 1px solid #aaa;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
th, tr:nth-child(even of :has(td)) td {
|
|
146
|
+
background: #43434f9c;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
pre {
|
|
151
|
+
background: #3e3d537b;
|
|
152
|
+
border: 1px solid #444;
|
|
153
|
+
|
|
154
|
+
.code__top * {
|
|
155
|
+
color: #f0ffff;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.post__header > p a, [role="main"] a, footer a {
|
|
161
|
+
color: #bac8ff;
|
|
162
|
+
text-decoration: underline 1px solid;
|
|
163
|
+
|
|
164
|
+
&:visited {
|
|
165
|
+
color: #df9fe6;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&.footnote, &.reversefootnote {
|
|
169
|
+
color: #ffaa6e;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&:not(.main__bg-fill) footer {
|
|
174
|
+
border-top: 1px solid #444;
|
|
175
|
+
color: white;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&.main__bg-fill footer {
|
|
179
|
+
border-top: none;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.btn__theme-toggle {
|
|
183
|
+
border: 2px solid #898886;
|
|
184
|
+
|
|
185
|
+
span.btn__theme-toggle-dark {
|
|
186
|
+
background: #6d6f6f;
|
|
187
|
+
|
|
188
|
+
i, span {
|
|
189
|
+
color: white;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.btn__scroll-up button {
|
|
195
|
+
border: 1px solid #f0f9fb;
|
|
196
|
+
}
|
|
197
|
+
}
|
data/assets/script.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Initialize polyfill for IE
|
|
5
|
+
const iedoc = document.documentMode;
|
|
6
|
+
NodeList.prototype.filter = Array.prototype.filter;
|
|
7
|
+
if(iedoc) NodeList.prototype.forEach = Array.prototype.forEach, Element.prototype.closest = function(s) {
|
|
8
|
+
let e = this;
|
|
9
|
+
while(e) {
|
|
10
|
+
e = e.parentElement;
|
|
11
|
+
if(!e || e.msMatchesSelector(s)) return e;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// Initialize page theme
|
|
16
|
+
let th = document.querySelector(".btn__theme-toggle"), th_dark = window.matchMedia("(prefers-color-scheme: dark)"), th_match = th_dark && th_dark.matches, th_val = sessionStorage.getItem("theme"), th_ev = function(v) {
|
|
17
|
+
const t = (th_match = v) ? "dark" : "light";
|
|
18
|
+
document.body.id = "main__theme-" + t;
|
|
19
|
+
sessionStorage.setItem("theme", t);
|
|
20
|
+
};
|
|
21
|
+
if(th_dark) th_dark.onchange = function() {th_ev(th_dark.matches)};
|
|
22
|
+
th.onclick = function() {th_ev(!th_match)};
|
|
23
|
+
document.body.id = "main__theme-" + (th_val == "dark" || th_val == "light" ? th_val : th_match ? "dark" : "light");
|
|
24
|
+
|
|
25
|
+
// Initialize navigation menu
|
|
26
|
+
const nav = document.querySelector("nav"), nav_btn = nav.querySelector("button"), nav_links = nav.querySelector(".nav__links"), nav_ev = function() {if(nav.classList.contains("nav__multi")) nav_btn.innerHTML = nav.classList.toggle("nav__open") ? "\ue4f6 Close" : "\ue2f0 Menu"};
|
|
27
|
+
nav.style.display = "flex";
|
|
28
|
+
nav_btn.onclick = function() {
|
|
29
|
+
nav_ev();
|
|
30
|
+
navigator.userAgentData.mobile && history.pushState(null, null, window.location.pathname);
|
|
31
|
+
};
|
|
32
|
+
nav_links.onclick = function(e) {e.target.tagName != "a" && nav_ev()};
|
|
33
|
+
navigator.userAgentData && navigator.userAgentData.mobile ? window.onpopstate = nav_ev : nav_links.addEventListener("wheel", function(e) {
|
|
34
|
+
if(window.innerWidth >= 768) {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
nav_links.scrollLeft += e.deltaY;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Initialize \"Scroll to top\" button
|
|
41
|
+
function scroll_ev() {
|
|
42
|
+
const e = document.querySelector("header"), r = e.getBoundingClientRect(), h = window.innerHeight;
|
|
43
|
+
if(document.body.clientHeight > h && (r.bottom <= h * .2) != document.body.classList.contains("main__scroll-down")) document.body.classList.toggle("main__scroll-down");
|
|
44
|
+
}
|
|
45
|
+
window.onscroll = scroll_ev;
|
|
46
|
+
window.onresize = scroll_ev;
|
|
47
|
+
if(window.screen.orientation) window.screen.orientation.onchange = scroll_ev;
|
|
48
|
+
|
|
49
|
+
// Add miscellaneous things to HTML elements
|
|
50
|
+
const link = function(a) {
|
|
51
|
+
const e = new RegExp("^((https?|mailto|tel):)?\\/*(.+@)?(www\\.)?([a-z\\d.-]+)?.*$", "gi").exec(a.href);
|
|
52
|
+
if(e && e[5] != location.hostname) a.target = "_blank";
|
|
53
|
+
}, ic = {
|
|
54
|
+
note: "info",
|
|
55
|
+
tip: "lightbulb",
|
|
56
|
+
important: "chat",
|
|
57
|
+
warning: "warning",
|
|
58
|
+
caution: "siren"
|
|
59
|
+
};
|
|
60
|
+
document.querySelectorAll("a").forEach(link);
|
|
61
|
+
document.querySelectorAll("a.footnote").forEach(function(f) {f.innerText = "[" + f.innerText + "]"});
|
|
62
|
+
document.querySelectorAll("a.reversefootnote").forEach(function(r) {r.innerHTML = "<i class=\"ph ph-arrow-u-up-left\"></i>"});
|
|
63
|
+
document.querySelectorAll("blockquote").forEach(function(b) {
|
|
64
|
+
const e = b.firstElementChild;
|
|
65
|
+
if(e) {
|
|
66
|
+
const r = new RegExp("^\\[!(note|tip|important|warning|caution)\\]($| )", "i").exec(e.innerText.trim());
|
|
67
|
+
if(r) {
|
|
68
|
+
b.classList.add("quote__alert-" + r[1].toLowerCase());
|
|
69
|
+
b.insertAdjacentHTML("afterbegin", "<p class=\"quote__alert-title\">" + r[1].charAt(0).toUpperCase() + r[1].slice(1).toLowerCase() + "</p>");
|
|
70
|
+
e.innerHTML = e.innerHTML.replace(new RegExp("^\\[!(note|tip|important|warning|caution)\\]", "i"), "").trim();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
document.querySelectorAll("details").forEach(function(d) {
|
|
75
|
+
let s = d.querySelector("summary");
|
|
76
|
+
if(!s) {
|
|
77
|
+
s = document.createElement("summary");
|
|
78
|
+
d.insertBefore(s, d.firstChild);
|
|
79
|
+
}
|
|
80
|
+
s.insertAdjacentHTML("afterbegin", "<i class=\"ph ph-caret-right\"></i>");
|
|
81
|
+
if(iedoc) s.onclick = function() {d.open = !d.hasAttribute("open")};
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
document.querySelectorAll("pre").filter(function(e) {for(let i = 0, ch = e.children[i]; i < e.children.length; i++, ch = e.children[i]) if(ch.tagName == "CODE") return true; return false}).forEach(function(pre) {
|
|
85
|
+
const code = (pre.closest("figure.highlight") ? pre.querySelector("table.rouge-table td.code > pre") : pre.querySelector("code")).textContent, code_par = pre.closest("div.highlighter-rouge") || pre.querySelector("code"), code_lang_regex = code_par.classList.length > 0 ? new RegExp("^language-(.+)$").exec(code_par.classList[0]) : null, code_lang = code_lang_regex && code_lang_regex.length > 1 ? code_lang_regex[1] : "plaintext";
|
|
86
|
+
|
|
87
|
+
const code_top = document.createElement("div");
|
|
88
|
+
code_top.className = "code__top";
|
|
89
|
+
code_top.insertAdjacentHTML("afterbegin", "<span>" + code_lang + "</span>");
|
|
90
|
+
|
|
91
|
+
const code_copy = document.createElement("button"), code_copy_reset = function() {
|
|
92
|
+
code_copy.className = "";
|
|
93
|
+
code_copy.innerText = "\ue1ca";
|
|
94
|
+
code_copy.title = "Copy";
|
|
95
|
+
}, code_copy_ev = function(b) {
|
|
96
|
+
const c = b ? "code__copy-ok" : "code__copy-bad";
|
|
97
|
+
code_copy.classList.toggle(c);
|
|
98
|
+
code_copy.classList.toggle("code__copy-na");
|
|
99
|
+
code_copy.innerText = b ? "\ue182" : "\ue4f6";
|
|
100
|
+
code_copy.title = b ? "Copied!" : "Error!";
|
|
101
|
+
setTimeout(code_copy_reset, 1500);
|
|
102
|
+
};
|
|
103
|
+
code_copy_reset();
|
|
104
|
+
code_copy.onclick = function() {if(!this.classList.contains("code__copy-na")) iedoc ? window.clipboardData.setData("Text", code) : navigator.clipboard.writeText(code).then(function() {code_copy_ev(true)}, function() {code_copy_ev(false)})};
|
|
105
|
+
|
|
106
|
+
if(!iedoc) {
|
|
107
|
+
// Initialize HTML/Markdown/ABCJS/Mermaid code preview
|
|
108
|
+
let abc = 0, preview_init = function(e) {
|
|
109
|
+
const code_preview = document.createElement("button");
|
|
110
|
+
code_preview.innerText = "\ue220";
|
|
111
|
+
code_preview.title = "Show source code/ preview";
|
|
112
|
+
code_preview.onclick = function() {this.innerText = pre.classList.toggle("code__preview") ? "\ue1bc" : "\ue220"};
|
|
113
|
+
code_top.appendChild(code_preview);
|
|
114
|
+
|
|
115
|
+
if(!e) e = document.createElement("div");
|
|
116
|
+
e.classList.add("code__preview-container");
|
|
117
|
+
pre.appendChild(e);
|
|
118
|
+
return e;
|
|
119
|
+
}, str64_encoder = new TextEncoder(), str64 = function(s) {return btoa(String.fromCharCode.apply(null, pako.deflate(str64_encoder.encode(s), {level: 9}))).replace(new RegExp("\\+", "g"), "-").replace(new RegExp("\\/", "g"), "_")}, min_opts = {
|
|
120
|
+
minifyCSS: true,
|
|
121
|
+
minifyJS: true,
|
|
122
|
+
removeComments: true,
|
|
123
|
+
collapseWhitespace: true,
|
|
124
|
+
conservativeCollapse: false,
|
|
125
|
+
preserveLineBreaks: false
|
|
126
|
+
};
|
|
127
|
+
switch(code_lang) {
|
|
128
|
+
case "html":
|
|
129
|
+
const f = document.createElement("iframe");
|
|
130
|
+
HTMLMinifier.minify(code, min_opts).then(function(t) {f.srcdoc = t});
|
|
131
|
+
preview_init(f).onload = function() {this.contentDocument.querySelectorAll("a").forEach(function(a) {a.target = "_blank", a.rel = "noopener noreferrer"})};
|
|
132
|
+
break;
|
|
133
|
+
|
|
134
|
+
case "md":
|
|
135
|
+
case "markdown":
|
|
136
|
+
const d = document.createElement("div");
|
|
137
|
+
HTMLMinifier.minify(DOMPurify.sanitize(marked.parse(code)), min_opts).then(function(t) {d.innerHTML = t});
|
|
138
|
+
d.querySelectorAll("a").forEach(link);
|
|
139
|
+
preview_init(d);
|
|
140
|
+
break;
|
|
141
|
+
|
|
142
|
+
case "abc":
|
|
143
|
+
case "abcjs":
|
|
144
|
+
const id = (++abc).toString();
|
|
145
|
+
preview_init(null).innerHTML = "<div id=\"paper" + id + "\"></div><div id=\"audio" + id + "\" class=\"synth\"></div>";
|
|
146
|
+
const p = ABCJS.renderAbc("paper" + id, code, {responsive: "resize"})[0];
|
|
147
|
+
|
|
148
|
+
if(ABCJS.synth.supportsAudio()) {
|
|
149
|
+
const c = new ABCJS.synth.SynthController();
|
|
150
|
+
c.load("#audio" + id, null, {
|
|
151
|
+
displayPlay: true,
|
|
152
|
+
displayProgress: true,
|
|
153
|
+
displayClock: true
|
|
154
|
+
});
|
|
155
|
+
c.disable(true);
|
|
156
|
+
|
|
157
|
+
const a = new ABCJS.synth.CreateSynth();
|
|
158
|
+
a.init({visualObj: p}).then(function() {c.setTune(p, true)});
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
|
|
162
|
+
case "mermaid":
|
|
163
|
+
case "mmd":
|
|
164
|
+
const img_mmd = document.createElement("img");
|
|
165
|
+
img_mmd.src = "https://kroki.io/mermaid/svg/" + str64(code);
|
|
166
|
+
preview_init(img_mmd);
|
|
167
|
+
break;
|
|
168
|
+
|
|
169
|
+
case "plantuml":
|
|
170
|
+
case "puml":
|
|
171
|
+
case "uml":
|
|
172
|
+
const img_uml = document.createElement("img");
|
|
173
|
+
img_uml.src = "https://kroki.io/plantuml/svg/" + str64(code);
|
|
174
|
+
preview_init(img_uml);
|
|
175
|
+
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
code_top.appendChild(code_copy);
|
|
180
|
+
pre.insertBefore(code_top, pre.firstChild);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
if(!iedoc) {
|
|
184
|
+
// Render KaTeX expressions and Mermaid graphs
|
|
185
|
+
document.querySelectorAll(".abcjs-inline-audio .abcjs-btn").forEach(function(i) {i.innerHTML = ""});
|
|
186
|
+
renderMathInElement(document.querySelector('[role="main"]'), {
|
|
187
|
+
delimiters: [
|
|
188
|
+
{left: "$$", right: "$$", display: true},
|
|
189
|
+
{left: "$", right: "$", display: false},
|
|
190
|
+
{left: "\\(", right: "\\)", display: false},
|
|
191
|
+
{left: "\\[", right: "\\]", display: true},
|
|
192
|
+
{left: "\\begin{equation}", right: "\\end{equation}", display: true},
|
|
193
|
+
{left: "\\begin{align}", right: "\\end{align}", display: true},
|
|
194
|
+
{left: "\\begin{alignat}", right: "\\end{alignat}", display: true},
|
|
195
|
+
{left: "\\begin{gather}", right: "\\end{gather}", display: true},
|
|
196
|
+
{left: "\\begin{CD}", right: "\\end{CD}", display: true}
|
|
197
|
+
],
|
|
198
|
+
throwOnError: true
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
})();
|
data/assets/style.scss
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
@import "main";
|
|
5
|
+
@import "theme";
|
|
6
|
+
@import "rouge";
|
|
7
|
+
@import "abcjs";
|
|
8
|
+
|
|
9
|
+
body#main__theme-light {
|
|
10
|
+
@include theme-light;
|
|
11
|
+
@include rouge-light;
|
|
12
|
+
@include abcjs-light;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
body#main__theme-dark {
|
|
16
|
+
@include theme-dark;
|
|
17
|
+
@include rouge-dark;
|
|
18
|
+
@include abcjs-dark;
|
|
19
|
+
}
|
data/posts.html
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Posts listing
|
|
4
|
+
permalink: /posts
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
{% if site.posts.size > 0 %}
|
|
8
|
+
<h3>Individual posts</h3>
|
|
9
|
+
<p>Some posts listed here may not belong to a specific tag or category.</p>
|
|
10
|
+
{% include list-post.html posts=site.posts %}
|
|
11
|
+
{% else %}
|
|
12
|
+
<p>There aren't any posts on this website.</p>
|
|
13
|
+
{% endif %}
|
|
14
|
+
|
|
15
|
+
{% if site.tags.size > 0 and site['jekyll-archives'].enabled == 'all' or site['jekyll-archives'].enabled contains 'tags' %}
|
|
16
|
+
<h3>Tags</h3>
|
|
17
|
+
{% include list-group.html dir='tag' group=site.tags icon='tag-simple' %}
|
|
18
|
+
{% endif %}
|
|
19
|
+
|
|
20
|
+
{% if site.categories.size > 0 and site['jekyll-archives'].enabled == 'all' or site['jekyll-archives'].enabled contains 'categories' %}
|
|
21
|
+
<h3>Categories</h3>
|
|
22
|
+
{% include list-group.html dir='category' group=site.categories icon='folder-simple' %}
|
|
23
|
+
{% endif %}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll-theme-simplix
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- lithier94675
|
|
@@ -40,7 +40,27 @@ dependencies:
|
|
|
40
40
|
executables: []
|
|
41
41
|
extensions: []
|
|
42
42
|
extra_rdoc_files: []
|
|
43
|
-
files:
|
|
43
|
+
files:
|
|
44
|
+
- 404.md
|
|
45
|
+
- LICENSE
|
|
46
|
+
- README.md
|
|
47
|
+
- _includes/footer.html
|
|
48
|
+
- _includes/head.html
|
|
49
|
+
- _includes/list-group.html
|
|
50
|
+
- _includes/list-post.html
|
|
51
|
+
- _includes/ui.html
|
|
52
|
+
- _layouts/archive.html
|
|
53
|
+
- _layouts/default.html
|
|
54
|
+
- _layouts/home.html
|
|
55
|
+
- _layouts/page.html
|
|
56
|
+
- _layouts/post.html
|
|
57
|
+
- _sass/abcjs.scss
|
|
58
|
+
- _sass/main.scss
|
|
59
|
+
- _sass/rouge.scss
|
|
60
|
+
- _sass/theme.scss
|
|
61
|
+
- assets/script.js
|
|
62
|
+
- assets/style.scss
|
|
63
|
+
- posts.html
|
|
44
64
|
homepage: https://lithier94675.github.io/jekyll-theme-simplix
|
|
45
65
|
licenses:
|
|
46
66
|
- CC0-1.0
|