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 +1 -1
- package/bin/marked +25 -17
- package/lib/marked.esm.js +1816 -0
- package/lib/marked.js +1548 -1454
- package/man/marked.1 +31 -11
- package/man/marked.1.txt +34 -34
- package/marked.min.js +2 -2
- package/package.json +37 -27
- package/src/InlineLexer.js +293 -0
- package/src/Lexer.js +402 -0
- package/src/Parser.js +206 -0
- package/src/Renderer.js +164 -0
- package/src/Slugger.js +30 -0
- package/src/TextRenderer.js +38 -0
- package/src/defaults.js +30 -0
- package/src/helpers.js +243 -0
- package/src/marked.js +150 -0
- package/src/rules.js +240 -0
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
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
17
|
+
const spawn = require('child_process').spawn;
|
|
18
18
|
|
|
19
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
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
|
-
|
|
158
|
-
|
|
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(
|
|
197
|
+
console.error('marked: output to ' + err.path + ': No such directory');
|
|
190
198
|
return process.exit(1);
|
|
191
199
|
}
|
|
192
200
|
throw err;
|