marked 0.3.19 → 0.4.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 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,16 +1,43 @@
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:
package/README.md CHANGED
@@ -1,11 +1,27 @@
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://img.shields.io/npm/v/marked.svg)](https://www.npmjs.com/package/marked)
8
+ [![gzip size](http://img.badgesize.io/https://cdn.jsdelivr.net/npm/marked@0.3.19/marked.min.js?compression=gzip)](https://cdn.jsdelivr.net/npm/marked@0.3.19/marked.min.js)
9
+ [![install size](https://packagephobia.now.sh/badge?p=marked@0.3.19)](https://packagephobia.now.sh/result?p=marked@0.3.19)
10
+ [![downloads](https://img.shields.io/npm/dt/marked.svg)](https://www.npmjs.com/package/marked)
11
+ [![travis](https://travis-ci.org/markedjs/marked.svg?branch=master)](https://travis-ci.org/markedjs/marked)
12
+
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)
17
+
18
+ ## Demo
19
+
20
+ Checkout the [demo page](https://marked.js.org/demo/) to see marked in action â›šī¸
21
+
22
+ ## Docs
4
23
 
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.
24
+ Our [documentation pages](https://marked.js.org) are also rendered using marked đŸ’¯
9
25
 
10
26
  ## Installation
11
27
 
@@ -33,10 +49,10 @@ $ cat hello.html
33
49
  <head>
34
50
  <meta charset="utf-8"/>
35
51
  <title>Marked in the browser</title>
36
- <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
37
52
  </head>
38
53
  <body>
39
54
  <div id="content"></div>
55
+ <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
40
56
  <script>
41
57
  document.getElementById('content').innerHTML =
42
58
  marked('# Marked in the browser\n\nRendered by **marked**.');
@@ -45,8 +61,6 @@ $ cat hello.html
45
61
  </html>
46
62
  ```
47
63
 
48
-
49
-
50
64
  ## License
51
65
 
52
66
  Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
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