marked 0.6.1 → 0.8.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 CHANGED
@@ -39,7 +39,7 @@ Also read about:
39
39
 
40
40
  ## Usage
41
41
 
42
- ### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML by default 🚨
42
+ ### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML. Please use a sanitize library, like [DOMPurify](https://github.com/cure53/DOMPurify) (recommended), [sanitize-html](https://github.com/apostrophecms/sanitize-html) or [insane](https://github.com/bevacqua/insane) on the output HTML! 🚨
43
43
 
44
44
  **CLI**
45
45
 
package/bin/marked CHANGED
@@ -5,18 +5,18 @@
5
5
  * Copyright (c) 2011-2013, Christopher Jeffrey (MIT License)
6
6
  */
7
7
 
8
- var fs = require('fs'),
9
- path = require('path'),
10
- marked = require('../');
8
+ const fs = require('fs'),
9
+ path = require('path'),
10
+ marked = require('../');
11
11
 
12
12
  /**
13
13
  * Man Page
14
14
  */
15
15
 
16
16
  function help() {
17
- var spawn = require('child_process').spawn;
17
+ const spawn = require('child_process').spawn;
18
18
 
19
- var options = {
19
+ const options = {
20
20
  cwd: process.cwd(),
21
21
  env: process.env,
22
22
  setsid: false,
@@ -32,22 +32,27 @@ function help() {
32
32
  });
33
33
  }
34
34
 
35
+ function version() {
36
+ const pkg = require('../package.json');
37
+ console.log(pkg.version);
38
+ }
39
+
35
40
  /**
36
41
  * Main
37
42
  */
38
43
 
39
44
  function main(argv, callback) {
40
- var files = [],
41
- options = {},
42
- input,
43
- output,
44
- string,
45
- arg,
46
- tokens,
47
- opt;
45
+ const files = [],
46
+ options = {};
47
+ let input,
48
+ output,
49
+ string,
50
+ arg,
51
+ tokens,
52
+ opt;
48
53
 
49
54
  function getarg() {
50
- var arg = argv.shift();
55
+ let arg = argv.shift();
51
56
 
52
57
  if (arg.indexOf('--') === 0) {
53
58
  // e.g. --opt
@@ -98,6 +103,9 @@ function main(argv, callback) {
98
103
  case '-h':
99
104
  case '--help':
100
105
  return help();
106
+ case '-v':
107
+ case '--version':
108
+ return version();
101
109
  default:
102
110
  if (arg.indexOf('--') === 0) {
103
111
  opt = camelize(arg.replace(/^--(no-)?/, ''));
@@ -154,8 +162,8 @@ function main(argv, callback) {
154
162
  */
155
163
 
156
164
  function getStdin(callback) {
157
- var stdin = process.stdin,
158
- buff = '';
165
+ const stdin = process.stdin;
166
+ let buff = '';
159
167
 
160
168
  stdin.setEncoding('utf8');
161
169
 
@@ -186,7 +194,7 @@ function camelize(text) {
186
194
 
187
195
  function handleError(err) {
188
196
  if (err.code === 'ENOENT') {
189
- console.error(`marked: output to ${err.path}: No such directory`);
197
+ console.error('marked: output to ' + err.path + ': No such directory');
190
198
  return process.exit(1);
191
199
  }
192
200
  throw err;