markdown-to-html-cli 3.2.14 → 3.4.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 +18 -13
- package/lib/create.js +5 -3
- package/lib/create.js.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.js +17 -13
- 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 +21 -13
- 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,kBAAoC;IACzF,MAAM,UAAU,GAA2B,EAAE,CAAA;IAC7C,IAAI,kBAAkB,EAAE;QACtB,UAAU,CAAC,KAAK,GAAG,kBAAkB,CAAC;KACvC;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 = {}, 'markdown-style-theme': markdownStyleTheme, '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, markdownStyleTheme);
|
|
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,10 @@ export interface RunArgvs extends Omit<ParsedArgs, '_'> {
|
|
|
17
17
|
'github-corners'?: string;
|
|
18
18
|
/** Github corners style. */
|
|
19
19
|
'github-corners-fork'?: boolean;
|
|
20
|
+
/** Disable light and dark theme styles button. */
|
|
21
|
+
'dark-mode'?: boolean;
|
|
22
|
+
/** Setting markdown-style light/dark theme. */
|
|
23
|
+
'markdown-style-theme'?: 'dark' | 'light';
|
|
20
24
|
/** Markdown string. */
|
|
21
25
|
markdown?: string;
|
|
22
26
|
/** The `<title>` tag is required in HTML documents! */
|
|
@@ -84,19 +88,21 @@ export function run(opts = {} as Omit<RunArgvs, '_'>) {
|
|
|
84
88
|
export const cliHelp: string = `\n Usage: markdown-to-html [options] [--help|h]
|
|
85
89
|
|
|
86
90
|
Options:\n
|
|
87
|
-
--author
|
|
88
|
-
--config, -o
|
|
89
|
-
--description
|
|
90
|
-
--favicon
|
|
91
|
-
--github-corners
|
|
92
|
-
--github-corners-fork
|
|
93
|
-
--keywords
|
|
94
|
-
--
|
|
95
|
-
--
|
|
96
|
-
--
|
|
97
|
-
--
|
|
98
|
-
--
|
|
99
|
-
--
|
|
91
|
+
--author Define the author of a page.
|
|
92
|
+
--config, -o Specify the configuration file. Default: "<process.cwd()>/package.json".
|
|
93
|
+
--description Define a description of your web page.
|
|
94
|
+
--favicon Add a Favicon to your Site.
|
|
95
|
+
--github-corners Add a Github corner to your project page.
|
|
96
|
+
--github-corners-fork Github corners style.
|
|
97
|
+
--keywords Define keywords for search engines.
|
|
98
|
+
--no-dark-mode Disable light and dark theme styles button.
|
|
99
|
+
--markdown Markdown string.
|
|
100
|
+
--markdown-style-theme Setting markdown-style light/dark theme.
|
|
101
|
+
--output, -o Output static pages to the specified directory. Default: "index.html"
|
|
102
|
+
--source, -s The path of the target file "README.md". Default: "README.md"
|
|
103
|
+
--title The \`<title>\` tag is required in HTML documents!
|
|
104
|
+
--version, -v Show version number
|
|
105
|
+
--help, -h Displays help information.
|
|
100
106
|
`;
|
|
101
107
|
|
|
102
108
|
export const exampleHelp: string =`\n Example:
|
|
@@ -105,6 +111,8 @@ export const exampleHelp: string =`\n Example:
|
|
|
105
111
|
\x1b[35mnpm\x1b[0m markdown-to-html \x1b[33m--title\x1b[0m="Hello World!"
|
|
106
112
|
\x1b[35mnpm\x1b[0m markdown-to-html \x1b[33m--config\x1b[0m="config/conf.json"
|
|
107
113
|
\x1b[35mnpm\x1b[0m markdown-to-html-cli \x1b[33m--markdown\x1b[0m="Hello World!"
|
|
114
|
+
\x1b[35mnpm\x1b[0m markdown-to-html-cli \x1b[33m--no-dark-mode\x1b[0m
|
|
115
|
+
\x1b[35mnpm\x1b[0m markdown-to-html-cli \x1b[33m--markdown-style-theme\x1b[0m dark
|
|
108
116
|
\x1b[35mnpm\x1b[0m markdown-to-html-cli \x1b[33m--github-corners\x1b[0m https://github.com/jaywcjlove/markdown-to-html-cli
|
|
109
117
|
\x1b[35mnpm\x1b[0m markdown-to-html-cli \x1b[33m--github-corners\x1b[0m https://github.com/jaywcjlove --github-corners-fork
|
|
110
118
|
\x1b[35mnpm\x1b[0m markdown-to-html-cli \x1b[33m--output\x1b[0m coverage/index.html
|