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 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
@@ -22,6 +22,7 @@
22
22
  "env": {
23
23
  "node": true,
24
24
  "browser": true,
25
- "amd": true
25
+ "amd": true,
26
+ "jasmine": true
26
27
  }
27
28
  }
package/.travis.yml CHANGED
@@ -1,16 +1,47 @@
1
1
  language: node_js
2
- node_js:
3
- - "0.10"
4
- - "4"
5
- - "lts/*"
6
- - "node"
7
- script: |
8
- if [ `node --version | cut -d . -f 1,2` = "v0.10" ]; then
9
- sed -i s/0o755/0755/ test/index.js;
10
- npm test;
11
- else
12
- npm run test:lint && npm test;
13
- fi
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
- <ul>
2
- <li><a href="#marked">About</a></li>
3
- <li><a href="#install">Installation</a></li>
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
- <h2 id="marked">Marked</h2>
5
+ # Marked
13
6
 
14
- Marked is
7
+ [![npm](https://badgen.net/npm/v/marked)](https://www.npmjs.com/package/marked)
8
+ [![gzip size](http://img.badgesize.io/https://cdn.jsdelivr.net/npm/marked/marked.min.js?compression=gzip)](https://cdn.jsdelivr.net/npm/marked/marked.min.js)
9
+ [![install size](https://badgen.net/packagephobia/install/marked)](https://packagephobia.now.sh/result?p=marked)
10
+ [![downloads](https://badgen.net/npm/dt/marked)](https://www.npmjs.com/package/marked)
11
+ [![travis](https://badgen.net/travis/markedjs/marked)](https://travis-ci.org/markedjs/marked)
15
12
 
16
- 1. built for speed.<sup>*</sup>
17
- 2. a low-level markdown compiler that allows frequent parsing of large chunks of markdown without caching or blocking for long periods of time.<sup>**</sup>
18
- 3. light-weight while implementing all markdown features from the supported flavors & specifications.<sup>***</sup>
19
- 4. available as a command line interface (CLI) and running in client- or server-side JavaScript projects.
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
- <p><small><sup>*</sup> Still working on metrics for comparative analysis and definition.</small><br>
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
- <h2 id="installation">Installation</h2>
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
- <h2 id="usage">Usage</h2>
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
- , util = require('util')
10
- , marked = require('../');
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
- customFds: [0, 1, 2]
23
+ stdio: 'inherit'
24
24
  };
25
25
 
26
- spawn('man', [__dirname + '/../man/marked.1'], options)
27
- .on('error', function(err) {
28
- fs.readFile(__dirname + '/../man/marked.1.txt', 'utf8', function(err, data) {
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
- , options = {}
42
- , input
43
- , output
44
- , arg
45
- , tokens
46
- , opt;
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
- , buff = '';
157
+ var stdin = process.stdin,
158
+ buff = '';
151
159
 
152
160
  stdin.setEncoding('utf8');
153
161
 
package/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marked",
3
- "homepage": "https://github.com/chjj/marked",
3
+ "homepage": "https://github.com/markedjs/marked",
4
4
  "authors": [
5
5
  "Christopher Jeffrey <chjjeffrey@gmail.com>"
6
6
  ],
package/component.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "marked",
3
3
  "version": "0.3.4",
4
- "repo": "chjj/marked",
4
+ "repo": "markedjs/marked",
5
5
  "description": "A markdown parser built for speed",
6
6
  "keywords": ["markdown", "markup", "html"],
7
7
  "scripts": ["lib/marked.js"],
package/jasmine.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "spec_dir": "test",
3
+ "spec_files": [
4
+ "**/*-spec.js"
5
+ ],
6
+ "helpers": [
7
+ "helpers/**/*.js"
8
+ ],
9
+ "stopSpecOnExpectationFailure": false,
10
+ "random": true
11
+ }