marked 0.3.18 → 0.5.1

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 CHANGED
@@ -1,13 +1,13 @@
1
1
  root = true
2
2
 
3
- [*, *.json, *.js]
3
+ [*.{json,js}]
4
4
  charset = utf-8
5
5
  end_of_line = lf
6
6
  insert_final_newline = true
7
7
  indent_style = space
8
8
  indent_size = 2
9
9
 
10
- [*.md, !test/*md]
10
+ [*.md, !test/*.md]
11
11
  charset = utf-8
12
12
  end_of_line = lf
13
13
  insert_final_newline = true
package/.eslintignore ADDED
@@ -0,0 +1 @@
1
+ *.min.js
package/.travis.yml CHANGED
@@ -1,17 +1,47 @@
1
1
  language: node_js
2
2
 
3
3
  jobs:
4
+ fast_finish: true
5
+ allow_failures:
6
+ - stage: security scan 🔐
7
+
4
8
  include:
9
+ - stage: unit tests 👩đŸŊ‍đŸ’ģ
10
+ script: npm run test:unit
11
+ node_js: lts/*
12
+
5
13
  - stage: spec tests 👩đŸŊ‍đŸ’ģ
14
+ script: npm run test:specs
6
15
  node_js: v0.10
7
16
  - node_js: v4
8
17
  - node_js: lts/*
9
18
  - node_js: node
10
19
 
11
20
  - stage: lint ✨
12
- node_js: lts/*
13
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/*
14
41
 
15
42
  cache:
16
43
  directories:
17
44
  - node_modules
45
+
46
+ git:
47
+ depth: 3
package/README.md CHANGED
@@ -1,11 +1,34 @@
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>
4
+
1
5
  # Marked
2
6
 
3
- Marked is
7
+ [![npm](https://badgen.net/npm/v/marked)](https://www.npmjs.com/package/marked)
8
+ [![gzip size](https://badgen.net/badgesize/gzip/https://cdn.jsdelivr.net/npm/marked/marked.min.js)](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
+ [![dep](https://badgen.net/david/dep/markedjs/marked)](https://david-dm.org/markedjs/marked)
12
+ [![dev dep](https://badgen.net/david/dev/markedjs/marked)](https://david-dm.org/markedjs/marked?type=dev)
13
+ [![travis](https://badgen.net/travis/markedjs/marked)](https://travis-ci.org/markedjs/marked)
14
+
15
+ - ⚡ built for speed
16
+ - âŦ‡ī¸ low-level compiler for parsing markdown without caching or blocking for long periods of time
17
+ - âš–ī¸ light-weight while implementing all markdown features from the supported flavors & specifications
18
+ - 🌐 works in a browser, on a server, or from a command line interface (CLI)
19
+
20
+ ## Demo
21
+
22
+ Checkout the [demo page](https://marked.js.org/demo/) to see marked in action â›šī¸
23
+
24
+ ## Docs
25
+
26
+ Our [documentation pages](https://marked.js.org) are also rendered using marked đŸ’¯
27
+
28
+ Also read about:
4
29
 
5
- 1. built for speed.
6
- 2. a low-level markdown compiler that allows frequent parsing of large chunks of markdown without caching or blocking for long periods of time.
7
- 3. light-weight while implementing all markdown features from the supported flavors & specifications.
8
- 4. available as a command line interface (CLI) and running in client- or server-side JavaScript projects.
30
+ * [Options](https://marked.js.org/#/USING_ADVANCED.md)
31
+ * [Extensibility](https://marked.js.org/#/USING_PRO.md)
9
32
 
10
33
  ## Installation
11
34
 
@@ -13,7 +36,9 @@ Marked is
13
36
 
14
37
  **In-browser:** `npm install marked --save`
15
38
 
16
- ## Usage
39
+ ## Usage
40
+
41
+ ### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML by default 🚨
17
42
 
18
43
  **CLI**
19
44
 
@@ -33,10 +58,10 @@ $ cat hello.html
33
58
  <head>
34
59
  <meta charset="utf-8"/>
35
60
  <title>Marked in the browser</title>
36
- <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
37
61
  </head>
38
62
  <body>
39
63
  <div id="content"></div>
64
+ <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
40
65
  <script>
41
66
  document.getElementById('content').innerHTML =
42
67
  marked('# Marked in the browser\n\nRendered by **marked**.');
@@ -45,9 +70,6 @@ $ cat hello.html
45
70
  </html>
46
71
  ```
47
72
 
48
-
49
-
50
73
  ## License
51
74
 
52
75
  Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
53
-
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