fossbook 0.0.9 → 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
- // Fall back to marked's default code rendering for everything else.
40
- return false;
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,6 +1,6 @@
1
1
  {
2
2
  "name": "fossbook",
3
- "version": "0.0.9",
3
+ "version": "0.0.12",
4
4
  "description": "A lightweight static blog site generator for GitHub Pages",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -1,69 +1,85 @@
1
- /* Tomorrow Night Blue Theme */
2
- /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
3
- /* Original theme - https://github.com/chriskempson/tomorrow-theme */
4
- /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
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: #7285b7;
14
+ color: #6a737d;
15
+ font-style: italic;
10
16
  }
11
17
 
12
- /* Tomorrow Red */
13
- .hljs-variable,
14
- .hljs-template-variable,
15
- .hljs-tag,
16
- .hljs-name,
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-type,
30
- .hljs-params,
31
- .hljs-meta,
32
- .hljs-link {
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: #d1f1a9;
38
+ color: #032f62;
47
39
  }
48
40
 
49
- /* Tomorrow Blue */
50
41
  .hljs-title,
51
- .hljs-section {
52
- color: #bbdaff;
42
+ .hljs-section,
43
+ .hljs-selector-id {
44
+ color: #6f42c1;
45
+ font-weight: bold;
53
46
  }
54
47
 
55
- /* Tomorrow Purple */
56
- .hljs-keyword,
57
- .hljs-selector-tag {
58
- color: #ebbbff;
48
+ .hljs-type,
49
+ .hljs-class .hljs-title {
50
+ color: #d73a49;
51
+ font-weight: bold;
59
52
  }
60
53
 
61
- .hljs {
62
- display: block;
63
- overflow-x: auto;
64
- background: #002451;
65
- color: white;
66
- padding: 0.5em;
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 {
@@ -153,10 +153,10 @@
153
153
  }
154
154
 
155
155
  pre {
156
- background-color: #ececec;
156
+ background-color: #f6f8fa;
157
157
  line-height: 1.4;
158
158
  overflow-x: auto;
159
- padding: 1em;
159
+ padding: 0;
160
160
  }
161
161
 
162
162
  .highlight pre ::selection {
@@ -302,9 +302,19 @@
302
302
  color:white;
303
303
  background-color: var(--hovercolor);
304
304
  }
305
- svg{
305
+ .soc svg{
306
306
  max-height: 15px;
307
307
  }
308
+ pre.mermaid{
309
+ background-color: transparent;
310
+ padding: 0;
311
+ text-align: center;
312
+ overflow-x: auto;
313
+ }
314
+ pre.mermaid svg{
315
+ max-width: 100%;
316
+ height: auto;
317
+ }
308
318
  .soc:hover{
309
319
  color: white;
310
320
  }
@@ -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) : ""}