fossbook 0.0.10 → 0.0.12
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.
package/lib/mod/marked.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
const marked = require("marked");
|
|
2
|
+
const hljs = require("highlight.js");
|
|
2
3
|
|
|
3
4
|
marked.setOptions({
|
|
4
5
|
renderer: new marked.Renderer(),
|
|
5
|
-
highlight: function (code, language) {
|
|
6
|
-
const hljs = require("highlight.js");
|
|
7
|
-
const validLanguage = hljs.getLanguage(language) ? language : "plaintext";
|
|
8
|
-
return hljs.highlight(validLanguage, code).value;
|
|
9
|
-
},
|
|
10
6
|
pedantic: false,
|
|
11
7
|
gfm: true,
|
|
12
8
|
breaks: false,
|
|
@@ -36,8 +32,14 @@ const renderer = {
|
|
|
36
32
|
.replace(/>/g, ">");
|
|
37
33
|
return `<pre class="mermaid">${escaped}</pre>`;
|
|
38
34
|
}
|
|
39
|
-
//
|
|
40
|
-
|
|
35
|
+
// Syntax-highlight every other fenced block with highlight.js so the
|
|
36
|
+
// theme (styles/highlights.css) can color the tokens.
|
|
37
|
+
const valid = language && hljs.getLanguage(language);
|
|
38
|
+
const { value } = valid
|
|
39
|
+
? hljs.highlight(text, { language })
|
|
40
|
+
: hljs.highlightAuto(text);
|
|
41
|
+
const cls = valid ? ` language-${language}` : "";
|
|
42
|
+
return `<pre><code class="hljs${cls}">${value}</code></pre>`;
|
|
41
43
|
},
|
|
42
44
|
image(href, title, text) {
|
|
43
45
|
let size = null;
|
package/package.json
CHANGED
|
@@ -1,69 +1,85 @@
|
|
|
1
|
-
/*
|
|
2
|
-
/*
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/* GitHub Light Theme */
|
|
2
|
+
/* Adapted from highlight.js github.css to fit a white page background. */
|
|
3
|
+
|
|
4
|
+
.hljs {
|
|
5
|
+
display: block;
|
|
6
|
+
overflow-x: auto;
|
|
7
|
+
background: #f6f8fa;
|
|
8
|
+
color: #24292e;
|
|
9
|
+
padding: 0.5em;
|
|
10
|
+
}
|
|
5
11
|
|
|
6
|
-
/* Tomorrow Comment */
|
|
7
12
|
.hljs-comment,
|
|
8
13
|
.hljs-quote {
|
|
9
|
-
color: #
|
|
14
|
+
color: #6a737d;
|
|
15
|
+
font-style: italic;
|
|
10
16
|
}
|
|
11
17
|
|
|
12
|
-
|
|
13
|
-
.hljs-
|
|
14
|
-
.hljs-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
.hljs-selector-id,
|
|
18
|
-
.hljs-selector-class,
|
|
19
|
-
.hljs-regexp,
|
|
20
|
-
.hljs-deletion {
|
|
21
|
-
color: #ff9da4;
|
|
18
|
+
.hljs-keyword,
|
|
19
|
+
.hljs-selector-tag,
|
|
20
|
+
.hljs-subst {
|
|
21
|
+
color: #d73a49;
|
|
22
|
+
font-weight: bold;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
/* Tomorrow Orange */
|
|
25
25
|
.hljs-number,
|
|
26
|
-
.hljs-built_in,
|
|
27
|
-
.hljs-builtin-name,
|
|
28
26
|
.hljs-literal,
|
|
29
|
-
.hljs-
|
|
30
|
-
.hljs-
|
|
31
|
-
.hljs-
|
|
32
|
-
|
|
33
|
-
color: #ffc58f;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/* Tomorrow Yellow */
|
|
37
|
-
.hljs-attribute {
|
|
38
|
-
color: #ffeead;
|
|
27
|
+
.hljs-variable,
|
|
28
|
+
.hljs-template-variable,
|
|
29
|
+
.hljs-tag .hljs-attr {
|
|
30
|
+
color: #005cc5;
|
|
39
31
|
}
|
|
40
32
|
|
|
41
|
-
/* Tomorrow Green */
|
|
42
33
|
.hljs-string,
|
|
34
|
+
.hljs-doctag,
|
|
43
35
|
.hljs-symbol,
|
|
44
36
|
.hljs-bullet,
|
|
45
37
|
.hljs-addition {
|
|
46
|
-
color: #
|
|
38
|
+
color: #032f62;
|
|
47
39
|
}
|
|
48
40
|
|
|
49
|
-
/* Tomorrow Blue */
|
|
50
41
|
.hljs-title,
|
|
51
|
-
.hljs-section
|
|
52
|
-
|
|
42
|
+
.hljs-section,
|
|
43
|
+
.hljs-selector-id {
|
|
44
|
+
color: #6f42c1;
|
|
45
|
+
font-weight: bold;
|
|
53
46
|
}
|
|
54
47
|
|
|
55
|
-
|
|
56
|
-
.hljs-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
.hljs-type,
|
|
49
|
+
.hljs-class .hljs-title {
|
|
50
|
+
color: #d73a49;
|
|
51
|
+
font-weight: bold;
|
|
59
52
|
}
|
|
60
53
|
|
|
61
|
-
.hljs
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
.hljs-tag,
|
|
55
|
+
.hljs-name,
|
|
56
|
+
.hljs-attribute {
|
|
57
|
+
color: #22863a;
|
|
58
|
+
font-weight: normal;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.hljs-regexp,
|
|
62
|
+
.hljs-link {
|
|
63
|
+
color: #032f62;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.hljs-built_in,
|
|
67
|
+
.hljs-builtin-name,
|
|
68
|
+
.hljs-params {
|
|
69
|
+
color: #e36209;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.hljs-meta {
|
|
73
|
+
color: #6a737d;
|
|
74
|
+
font-weight: bold;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.hljs-deletion {
|
|
78
|
+
background: #ffeef0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.hljs-addition {
|
|
82
|
+
background: #f0fff4;
|
|
67
83
|
}
|
|
68
84
|
|
|
69
85
|
.hljs-emphasis {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="stylesheet" href="${page.config.basePath}styles/fonts.css">
|
|
7
7
|
<link rel="stylesheet" href="${page.config.basePath}styles/main.css">
|
|
8
|
+
<link rel="stylesheet" href="${page.config.basePath}styles/highlights.css">
|
|
8
9
|
<link rel="icon" type="image/png" href="${page.config.basePath}images/favicon.png">
|
|
9
10
|
<!-- Google tag (gtag.js) -->
|
|
10
11
|
${page.config.googleAnalyticsID ? page.googleAnalytics(page.config.googleAnalyticsID) : ""}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
<link href="https://fonts.googleapis.com/css2?family=Comic+Neue:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&family=Nanum+Pen+Script&family=Playpen+Sans:wght@100..800&display=swap" rel="stylesheet">
|
|
9
9
|
<link rel="stylesheet" href="${page.config.basePath}styles/fonts.css">
|
|
10
10
|
<link rel="stylesheet" href="${page.config.basePath}styles/main.css">
|
|
11
|
+
<link rel="stylesheet" href="${page.config.basePath}styles/highlights.css">
|
|
11
12
|
<link rel="icon" type="image/png" href="${page.config.basePath}images/favicon.png">
|
|
12
13
|
<!-- Google tag (gtag.js) -->
|
|
13
14
|
${page.config.googleAnalyticsID ? page.googleAnalytics(page.config.googleAnalyticsID) : ""}
|