markdown-to-html-cli 3.2.14 → 3.3.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.
- package/README.md +1 -0
- package/lib/create.js +5 -3
- package/lib/create.js.map +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/nodes/markdown-style.d.ts +1 -1
- package/lib/nodes/markdown-style.js +8 -946
- package/lib/nodes/markdown-style.js.map +1 -1
- package/package.json +1 -1
- package/src/create.ts +5 -3
- package/src/index.ts +5 -0
- package/src/nodes/markdown-style.ts +8 -946
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-style.js","sourceRoot":"","sources":["../../src/nodes/markdown-style.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,YAAY,GAAG
|
|
1
|
+
{"version":3,"file":"markdown-style.js","sourceRoot":"","sources":["../../src/nodes/markdown-style.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuEpB,CAAA;AAED,MAAM,UAAU,aAAa,CAAC,KAAuB,EAAE,QAAiB;IACtE,MAAM,UAAU,GAA2B,EAAE,CAAA;IAC7C,IAAI,CAAC,QAAQ,EAAE;QACb,UAAU,CAAC,KAAK,GAAG,OAAO,CAAC;KAC5B;IACD,OAAO,CAAC;YACN,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,QAAQ;YACjB,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,uDAAuD;aACxD;YACD,QAAQ,EAAE,CAAC;oBACT,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,YAAY;iBACpB,CAAC;SACH,EAAE;YACD,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,UAAU,EAAE;gBACV,KAAK,EAAE,6DAA6D;aACrE;YACD,QAAQ,EAAE,CAAC;oBACT,IAAI,EAAE,SAAS;oBACf,UAAU;oBACV,OAAO,EAAE,gBAAgB;oBACzB,QAAQ,EAAE,KAAK;iBAChB,CAAC;SACH,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
package/src/create.ts
CHANGED
|
@@ -24,7 +24,7 @@ export const _dirname = __dirname;
|
|
|
24
24
|
export interface CreateOptions extends MDToHTMLOptions { }
|
|
25
25
|
|
|
26
26
|
export function create(options: MDToHTMLOptions = {}) {
|
|
27
|
-
const { markdown: string, document, rewrite, reurls = {} } = options;
|
|
27
|
+
const { markdown: string, document, rewrite, reurls = {}, 'dark-mode': darkModeTheme = true } = options;
|
|
28
28
|
|
|
29
29
|
const mdOptions: Options = {
|
|
30
30
|
hastNode: false,
|
|
@@ -42,8 +42,10 @@ export function create(options: MDToHTMLOptions = {}) {
|
|
|
42
42
|
],
|
|
43
43
|
rewrite: (node, index, parent) => {
|
|
44
44
|
if ((node.type == 'element' && node.tagName === 'body') || (!document && node.type === 'root')) {
|
|
45
|
-
node.children = markdownStyle(node.children as any);
|
|
46
|
-
|
|
45
|
+
node.children = markdownStyle(node.children as any, darkModeTheme);
|
|
46
|
+
if (darkModeTheme) {
|
|
47
|
+
darkMode().forEach(item => node.children.unshift(item));
|
|
48
|
+
}
|
|
47
49
|
}
|
|
48
50
|
if (options['github-corners'] && ((document && node.type == 'element' && node.tagName === 'body') || (!document && node.type === 'root'))) {
|
|
49
51
|
node.children = Array.isArray(node.children) ? node.children : [];
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export interface RunArgvs extends Omit<ParsedArgs, '_'> {
|
|
|
17
17
|
'github-corners'?: string;
|
|
18
18
|
/** Github corners style. */
|
|
19
19
|
'github-corners-fork'?: boolean;
|
|
20
|
+
'dark-mode'?: boolean;
|
|
20
21
|
/** Markdown string. */
|
|
21
22
|
markdown?: string;
|
|
22
23
|
/** The `<title>` tag is required in HTML documents! */
|
|
@@ -36,6 +37,8 @@ export interface RunArgvs extends Omit<ParsedArgs, '_'> {
|
|
|
36
37
|
export interface MDToHTMLOptions extends RunArgvs {
|
|
37
38
|
/** [rehype-document](https://github.com/rehypejs/rehype-document#options) options */
|
|
38
39
|
document?: Options;
|
|
40
|
+
/** */
|
|
41
|
+
darkMode?: boolean;
|
|
39
42
|
/** Rewrite Element. [rehype-rewrite](https://github.com/jaywcjlove/rehype-rewrite#rewritenode-index-parent-void) */
|
|
40
43
|
rewrite?: RehypeRewriteOptions['rewrite'];
|
|
41
44
|
/** rewrite URLs of href and src attributes. */
|
|
@@ -91,6 +94,7 @@ export const cliHelp: string = `\n Usage: markdown-to-html [options] [--help|h]
|
|
|
91
94
|
--github-corners Add a Github corner to your project page.
|
|
92
95
|
--github-corners-fork Github corners style.
|
|
93
96
|
--keywords Define keywords for search engines.
|
|
97
|
+
--no-dark-mode Disable light and dark theme styles button.
|
|
94
98
|
--markdown Markdown string.
|
|
95
99
|
--output, -o Output static pages to the specified directory. Default: "index.html"
|
|
96
100
|
--source, -s The path of the target file "README.md". Default: "README.md"
|
|
@@ -105,6 +109,7 @@ export const exampleHelp: string =`\n Example:
|
|
|
105
109
|
\x1b[35mnpm\x1b[0m markdown-to-html \x1b[33m--title\x1b[0m="Hello World!"
|
|
106
110
|
\x1b[35mnpm\x1b[0m markdown-to-html \x1b[33m--config\x1b[0m="config/conf.json"
|
|
107
111
|
\x1b[35mnpm\x1b[0m markdown-to-html-cli \x1b[33m--markdown\x1b[0m="Hello World!"
|
|
112
|
+
\x1b[35mnpm\x1b[0m markdown-to-html-cli \x1b[33m--no-dark-mode\x1b[0m
|
|
108
113
|
\x1b[35mnpm\x1b[0m markdown-to-html-cli \x1b[33m--github-corners\x1b[0m https://github.com/jaywcjlove/markdown-to-html-cli
|
|
109
114
|
\x1b[35mnpm\x1b[0m markdown-to-html-cli \x1b[33m--github-corners\x1b[0m https://github.com/jaywcjlove --github-corners-fork
|
|
110
115
|
\x1b[35mnpm\x1b[0m markdown-to-html-cli \x1b[33m--output\x1b[0m coverage/index.html
|