marked 0.3.17 → 0.5.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/.editorconfig +16 -0
- package/.eslintignore +1 -0
- package/.eslintrc.json +2 -1
- package/.travis.yml +43 -12
- package/README.md +32 -56
- package/bin/marked +24 -16
- package/bower.json +1 -1
- package/component.json +1 -1
- package/jasmine.json +11 -0
- package/lib/marked.js +345 -155
- package/man/marked.1 +2 -2
- package/man/marked.1.txt +1 -1
- package/marked.min.js +2 -2
- package/package.json +16 -5
- package/AUTHORS.md +0 -45
- package/CONTRIBUTING.md +0 -95
- package/LICENSE.md +0 -43
- package/RELEASE.md +0 -24
- package/USAGE_ADVANCED.md +0 -71
- package/USAGE_EXTENSIBILITY.md +0 -136
- package/doc/broken.md +0 -426
- package/doc/todo.md +0 -2
package/.editorconfig
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*.{json,js}]
|
|
4
|
+
charset = utf-8
|
|
5
|
+
end_of_line = lf
|
|
6
|
+
insert_final_newline = true
|
|
7
|
+
indent_style = space
|
|
8
|
+
indent_size = 2
|
|
9
|
+
|
|
10
|
+
[*.md, !test/*.md]
|
|
11
|
+
charset = utf-8
|
|
12
|
+
end_of_line = lf
|
|
13
|
+
insert_final_newline = true
|
|
14
|
+
trim_trailing_whitespace = true
|
|
15
|
+
indent_style = tab
|
|
16
|
+
indent_size = 4
|
package/.eslintignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.min.js
|
package/.eslintrc.json
CHANGED
package/.travis.yml
CHANGED
|
@@ -1,16 +1,47 @@
|
|
|
1
1
|
language: node_js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
|
|
3
|
+
jobs:
|
|
4
|
+
fast_finish: true
|
|
5
|
+
allow_failures:
|
|
6
|
+
- stage: security scan 🔐
|
|
7
|
+
|
|
8
|
+
include:
|
|
9
|
+
- stage: unit tests 👩🏽💻
|
|
10
|
+
script: npm run test:unit
|
|
11
|
+
node_js: lts/*
|
|
12
|
+
|
|
13
|
+
- stage: spec tests 👩🏽💻
|
|
14
|
+
script: npm run test:specs
|
|
15
|
+
node_js: v0.10
|
|
16
|
+
- node_js: v4
|
|
17
|
+
- node_js: lts/*
|
|
18
|
+
- node_js: node
|
|
19
|
+
|
|
20
|
+
- stage: lint ✨
|
|
21
|
+
script: npm run test:lint
|
|
22
|
+
node_js: lts/*
|
|
23
|
+
|
|
24
|
+
- stage: minify 🗜️
|
|
25
|
+
script: |
|
|
26
|
+
npm run build
|
|
27
|
+
if ! git diff --quiet; then
|
|
28
|
+
git config --global user.email "travis@travis-ci.org"
|
|
29
|
+
git config --global user.name "Travis-CI"
|
|
30
|
+
git config credential.helper "store --file=.git/credentials"
|
|
31
|
+
echo "https://${GITHUB_TOKEN}:@github.com" > .git/credentials
|
|
32
|
+
git commit -am '🗜️ minify [skip ci]'
|
|
33
|
+
git push origin HEAD:${TRAVIS_BRANCH}
|
|
34
|
+
fi
|
|
35
|
+
node_js: lts/*
|
|
36
|
+
if: branch = master AND type = push
|
|
37
|
+
|
|
38
|
+
- stage: security scan 🔐
|
|
39
|
+
script: npm run test:redos
|
|
40
|
+
node_js: lts/*
|
|
41
|
+
|
|
14
42
|
cache:
|
|
15
43
|
directories:
|
|
16
44
|
- node_modules
|
|
45
|
+
|
|
46
|
+
git:
|
|
47
|
+
depth: 3
|
package/README.md
CHANGED
|
@@ -1,34 +1,42 @@
|
|
|
1
|
-
<
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
<li><a href="#usage">Usage</a></li>
|
|
5
|
-
<li><a href="#specifications">Supported Markdown specifications</a></li>
|
|
6
|
-
<li><a href="#security">Security</a></li>
|
|
7
|
-
<li><a href="#contributing">Contributing</a></li>
|
|
8
|
-
<li><a href="#authors">Authors</a></li>
|
|
9
|
-
<li><a href="#license">License</a></li>
|
|
10
|
-
</ul>
|
|
1
|
+
<a href="https://marked.js.org">
|
|
2
|
+
<img width="60px" height="60px" src="https://marked.js.org/img/logo-black.svg" align="right" />
|
|
3
|
+
</a>
|
|
11
4
|
|
|
12
|
-
|
|
5
|
+
# Marked
|
|
13
6
|
|
|
14
|
-
|
|
7
|
+
[](https://www.npmjs.com/package/marked)
|
|
8
|
+
[](https://cdn.jsdelivr.net/npm/marked/marked.min.js)
|
|
9
|
+
[](https://packagephobia.now.sh/result?p=marked)
|
|
10
|
+
[](https://www.npmjs.com/package/marked)
|
|
11
|
+
[](https://travis-ci.org/markedjs/marked)
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
- ⚡ built for speed
|
|
14
|
+
- ⬇️ low-level compiler for parsing markdown without caching or blocking for long periods of time
|
|
15
|
+
- ⚖️ light-weight while implementing all markdown features from the supported flavors & specifications
|
|
16
|
+
- 🌐 works in a browser, on a server, or from a command line interface (CLI)
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
<small><sup>**</sup> As few dependencies as possible.</small><br>
|
|
23
|
-
<small><sup>***</sup> Strict compliance could result in slower processing when running comparative benchmarking.</small></p>
|
|
18
|
+
## Demo
|
|
24
19
|
|
|
25
|
-
|
|
20
|
+
Checkout the [demo page](https://marked.js.org/demo/) to see marked in action ⛹️
|
|
21
|
+
|
|
22
|
+
## Docs
|
|
23
|
+
|
|
24
|
+
Our [documentation pages](https://marked.js.org) are also rendered using marked 💯
|
|
25
|
+
|
|
26
|
+
Also read about:
|
|
27
|
+
|
|
28
|
+
* [Options](https://marked.js.org/#/USING_ADVANCED.md)
|
|
29
|
+
* [Extensibility](https://marked.js.org/#/USING_PRO.md)
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
26
32
|
|
|
27
33
|
**CLI:** `npm install -g marked`
|
|
28
34
|
|
|
29
35
|
**In-browser:** `npm install marked --save`
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML by default 🚨
|
|
32
40
|
|
|
33
41
|
**CLI**
|
|
34
42
|
|
|
@@ -48,50 +56,18 @@ $ cat hello.html
|
|
|
48
56
|
<head>
|
|
49
57
|
<meta charset="utf-8"/>
|
|
50
58
|
<title>Marked in the browser</title>
|
|
51
|
-
<script src="/path/to/marked.min.js"></script>
|
|
52
59
|
</head>
|
|
53
60
|
<body>
|
|
54
61
|
<div id="content"></div>
|
|
62
|
+
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
|
55
63
|
<script>
|
|
56
64
|
document.getElementById('content').innerHTML =
|
|
57
|
-
marked('# Marked in browser\n\nRendered by **marked**.');
|
|
65
|
+
marked('# Marked in the browser\n\nRendered by **marked**.');
|
|
58
66
|
</script>
|
|
59
67
|
</body>
|
|
60
68
|
</html>
|
|
61
69
|
```
|
|
62
70
|
|
|
63
|
-
|
|
64
|
-
Marked offers [advanced configurations](https://github.com/markedjs/marked/blob/master/USAGE_ADVANCED.md) and [extensibility](https://github.com/markedjs/marked/blob/master/USAGE_EXTENSIBILITY.md) as well.
|
|
65
|
-
|
|
66
|
-
<h2 id="specifications">Supported Markdown specifications</h2>
|
|
67
|
-
|
|
68
|
-
We actively support the features of the following [Markdown flavors](https://github.com/commonmark/CommonMark/wiki/Markdown-Flavors).
|
|
69
|
-
|
|
70
|
-
|Flavor |Version |
|
|
71
|
-
|:----------------------------------------------------------|:----------|
|
|
72
|
-
|The original markdown.pl |-- |
|
|
73
|
-
|[CommonMark](http://spec.commonmark.org/0.28/) |0.28 |
|
|
74
|
-
|[GitHub Flavored Markdown](https://github.github.com/gfm/) |0.28 |
|
|
75
|
-
|
|
76
|
-
By supporting the above Markdown flavors, it's possible that Marked can help you use other flavors as well; however, these are not actively supported by the community.
|
|
77
|
-
|
|
78
|
-
<h2 id="security">Security</h2>
|
|
79
|
-
|
|
80
|
-
The only completely secure system is the one that doesn't exist in the first place. Having said that, we take the security of Marked very seriously; however, none of us are necessarily security experts, so to speak. Therefore, if you find something, [say something](https://github.com/markedjs/marked/issues), or, better yet, fix the thing! :)
|
|
81
|
-
|
|
82
|
-
<h2 id="contributing">Contributing</h2>
|
|
83
|
-
|
|
84
|
-
The marked community enjoys a spirit of collaboration and contribution from all comers. Whether you're just getting started with Markdown, JavaScript, and Marked or you're a veteran with it all figured out, we're here to help each other improve as professionals while helping Marked improve technically. Please see our [contributing documentation](https://github.com/markedjs/marked/blob/master/CONTRIBUTING.md) for more details.
|
|
85
|
-
|
|
86
|
-
For our Contribution License Agreement, see our [license](https://github.com/markedjs/marked/blob/master/LICENSE.md).
|
|
87
|
-
|
|
88
|
-
<h2 id="authors">Authors</h2>
|
|
89
|
-
|
|
90
|
-
For list of credited authors and contributors, please see our [authors page](https://github.com/markedjs/marked/blob/master/AUTHORS.md).
|
|
91
|
-
|
|
92
|
-
<h2 id="license">License</h2>
|
|
71
|
+
## License
|
|
93
72
|
|
|
94
73
|
Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
95
|
-
|
|
96
|
-
See [license](https://github.com/markedjs/marked/blob/master/LICENSE.md) for more details.
|
|
97
|
-
|
package/bin/marked
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* Copyright (c) 2011-2013, Christopher Jeffrey (MIT License)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
var fs = require('fs')
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
var fs = require('fs'),
|
|
9
|
+
path = require('path'),
|
|
10
|
+
marked = require('../');
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Man Page
|
|
@@ -20,12 +20,12 @@ function help() {
|
|
|
20
20
|
cwd: process.cwd(),
|
|
21
21
|
env: process.env,
|
|
22
22
|
setsid: false,
|
|
23
|
-
|
|
23
|
+
stdio: 'inherit'
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
spawn('man', [__dirname
|
|
27
|
-
.on('error', function(
|
|
28
|
-
fs.readFile(__dirname
|
|
26
|
+
spawn('man', [path.resolve(__dirname, '/../man/marked.1')], options)
|
|
27
|
+
.on('error', function() {
|
|
28
|
+
fs.readFile(path.resolve(__dirname, '/../man/marked.1.txt'), 'utf8', function(err, data) {
|
|
29
29
|
if (err) throw err;
|
|
30
30
|
console.log(data);
|
|
31
31
|
});
|
|
@@ -37,13 +37,14 @@ function help() {
|
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
39
|
function main(argv, callback) {
|
|
40
|
-
var files = []
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
var files = [],
|
|
41
|
+
options = {},
|
|
42
|
+
input,
|
|
43
|
+
output,
|
|
44
|
+
string,
|
|
45
|
+
arg,
|
|
46
|
+
tokens,
|
|
47
|
+
opt;
|
|
47
48
|
|
|
48
49
|
function getarg() {
|
|
49
50
|
var arg = argv.shift();
|
|
@@ -86,6 +87,10 @@ function main(argv, callback) {
|
|
|
86
87
|
case '--input':
|
|
87
88
|
input = argv.shift();
|
|
88
89
|
break;
|
|
90
|
+
case '-s':
|
|
91
|
+
case '--string':
|
|
92
|
+
string = argv.shift();
|
|
93
|
+
break;
|
|
89
94
|
case '-t':
|
|
90
95
|
case '--tokens':
|
|
91
96
|
tokens = true;
|
|
@@ -118,6 +123,9 @@ function main(argv, callback) {
|
|
|
118
123
|
function getData(callback) {
|
|
119
124
|
if (!input) {
|
|
120
125
|
if (files.length <= 2) {
|
|
126
|
+
if (string) {
|
|
127
|
+
return callback(null, string);
|
|
128
|
+
}
|
|
121
129
|
return getStdin(callback);
|
|
122
130
|
}
|
|
123
131
|
input = files.pop();
|
|
@@ -146,8 +154,8 @@ function main(argv, callback) {
|
|
|
146
154
|
*/
|
|
147
155
|
|
|
148
156
|
function getStdin(callback) {
|
|
149
|
-
var stdin = process.stdin
|
|
150
|
-
|
|
157
|
+
var stdin = process.stdin,
|
|
158
|
+
buff = '';
|
|
151
159
|
|
|
152
160
|
stdin.setEncoding('utf8');
|
|
153
161
|
|
package/bower.json
CHANGED
package/component.json
CHANGED