hdoc-tools 0.7.23 → 0.7.24
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/hdoc-build.js +21 -7
- package/hdoc-serve.js +20 -2
- package/package.json +1 -1
package/hdoc-build.js
CHANGED
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
validate = require(path.join(__dirname, 'hdoc-validate.js')),
|
|
9
9
|
hdoc = require(path.join(__dirname, 'hdoc-module.js')),
|
|
10
10
|
zipper = require('zip-local');
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
|
|
13
12
|
|
|
14
13
|
let conversion_attempted = 0,
|
|
15
14
|
conversion_success = 0,
|
|
@@ -38,17 +37,32 @@
|
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
const mdfm = require('markdown-it-front-matter');
|
|
41
|
+
const md = require('markdown-it')({
|
|
42
|
+
// enable everything
|
|
43
|
+
html: true,
|
|
44
|
+
linkify: true,
|
|
45
|
+
typographer: true,
|
|
46
|
+
// highlight: function (str, lang) {
|
|
47
|
+
// if (lang && hljs.getLanguage(lang)) {
|
|
48
|
+
// try {
|
|
49
|
+
// return hljs.highlight(lang, str, true).value;
|
|
50
|
+
// } catch (__) {}
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
var frontmatter_content = "";
|
|
42
56
|
md.use(mdfm, function (fm) {
|
|
43
|
-
|
|
57
|
+
frontmatter_content = fm;
|
|
58
|
+
console.log("FM:", fm);
|
|
44
59
|
});
|
|
45
|
-
|
|
60
|
+
|
|
46
61
|
// Render markdown into HTML
|
|
47
|
-
frontmatter_content = "";
|
|
48
62
|
var html_txt = md.render(md_txt.toString());
|
|
49
63
|
|
|
50
64
|
if (frontmatter_content.length) {
|
|
51
|
-
html_txt = "<!--[[FRONTMATTER\r\n" + frontmatter_content + "]]-->\r\n" + html_txt;
|
|
65
|
+
html_txt = "<!--[[FRONTMATTER\r\n" + frontmatter_content + "\r\n]]-->\r\n" + html_txt;
|
|
52
66
|
}
|
|
53
67
|
|
|
54
68
|
// Save HTML into HTML file
|
package/hdoc-serve.js
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
path = require('path'),
|
|
7
7
|
hdoc = require(path.join(__dirname, 'hdoc-module.js')),
|
|
8
8
|
stream = require('stream');
|
|
9
|
+
|
|
10
|
+
const yaml = require('js-yaml');
|
|
9
11
|
const mdfm = require('markdown-it-front-matter');
|
|
10
12
|
|
|
11
13
|
let port = 3000;
|
|
@@ -90,9 +92,25 @@
|
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
|
|
95
|
+
const mdfm = require('markdown-it-front-matter');
|
|
96
|
+
const md = require('markdown-it')({
|
|
97
|
+
// enable everything
|
|
98
|
+
html: true,
|
|
99
|
+
linkify: true,
|
|
100
|
+
typographer: true,
|
|
101
|
+
// highlight: function (str, lang) {
|
|
102
|
+
// if (lang && hljs.getLanguage(lang)) {
|
|
103
|
+
// try {
|
|
104
|
+
// return hljs.highlight(lang, str, true).value;
|
|
105
|
+
// } catch (__) {}
|
|
106
|
+
// }
|
|
107
|
+
// }
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
var frontmatter_content = "";
|
|
94
111
|
md.use(mdfm, function (fm) {
|
|
95
|
-
|
|
112
|
+
frontmatter_content = fm;
|
|
113
|
+
console.log("FM:", fm);
|
|
96
114
|
});
|
|
97
115
|
|
|
98
116
|
// Render markdown into HTML
|