marked 4.0.1 → 4.0.5

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 CHANGED
@@ -47,7 +47,9 @@ Also read about:
47
47
 
48
48
  **CLI**
49
49
 
50
+
50
51
  ``` bash
52
+ # Example with stdin input
51
53
  $ marked -o hello.html
52
54
  hello world
53
55
  ^D
@@ -55,6 +57,11 @@ $ cat hello.html
55
57
  <p>hello world</p>
56
58
  ```
57
59
 
60
+ ```bash
61
+ # Print all options
62
+ $ marked --help
63
+ ```
64
+
58
65
  **Browser**
59
66
 
60
67
  ```html
package/bin/marked.js CHANGED
@@ -27,10 +27,16 @@ async function help() {
27
27
  const { dirname, resolve } = await import('path');
28
28
  const { fileURLToPath } = await import('url');
29
29
  const __dirname = dirname(fileURLToPath(import.meta.url));
30
- spawn('man', [resolve(__dirname, '../man/marked.1')], options)
31
- .on('error', async() => {
32
- console.log(await readFile(resolve(__dirname, '../man/marked.1.txt'), 'utf8'));
33
- });
30
+ const helpText = await readFile(resolve(__dirname, '../man/marked.1.txt'), 'utf8');
31
+
32
+ // eslint-disable-next-line promise/param-names
33
+ await new Promise(res => {
34
+ spawn('man', [resolve(__dirname, '../man/marked.1')], options)
35
+ .on('error', () => {
36
+ console.log(helpText);
37
+ })
38
+ .on('close', res);
39
+ });
34
40
  }
35
41
 
36
42
  async function version() {
@@ -149,7 +155,7 @@ async function main(argv) {
149
155
  : marked(data, options);
150
156
 
151
157
  if (output) {
152
- return await writeFile(output, data);
158
+ return await writeFile(output, html);
153
159
  }
154
160
 
155
161
  process.stdout.write(html + '\n');