Skip to content

Commit c3cafff

Browse files
authored
Merge pull request #1563 from UziTech/rollup
Separate marked into modules
2 parents 4584a8a + 2571795 commit c3cafff

30 files changed

+6853
-1766
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
lib
12
*.min.js

.eslintrc.json

+5-8
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
"plugins": [
44
"standard"
55
],
6-
"parserOptions": {
7-
"ecmaVersion": 5,
8-
"sourceType": "script"
9-
},
106
"rules": {
117
"semi": ["error", "always"],
128
"indent": ["error", 2, {
@@ -20,11 +16,12 @@
2016
"no-useless-escape": "off",
2117
"one-var": "off",
2218
"no-control-regex": "off",
23-
"no-prototype-builtins": "off"
19+
"no-prototype-builtins": "off",
20+
21+
"prefer-const": "error",
22+
"no-var": "error"
2423
},
2524
"env": {
26-
"node": true,
27-
"browser": true,
28-
"amd": true
25+
"node": true
2926
}
3027
}

.travis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ jobs:
1919
script: npm run test:lint
2020
node_js: lts/*
2121

22-
- stage: minify 🗜️
22+
- stage: build 🗜️
2323
script: |
2424
npm run build
2525
if ! git diff --quiet; then
2626
git config --global user.email "travis@travis-ci.org"
2727
git config --global user.name "Travis-CI"
2828
git config credential.helper "store --file=.git/credentials"
2929
echo "https://${GITHUB_TOKEN}:@github.com" > .git/credentials
30-
git commit -am '🗜️ minify [skip ci]'
30+
git commit -am '🗜️ build [skip ci]'
3131
git push origin HEAD:${TRAVIS_BRANCH}
3232
fi
3333
node_js: lts/*
3434
if: branch = master AND type = push
3535

36-
- stage: security scan 🔐
37-
script: npm run test:redos
38-
node_js: lts/*
36+
# - stage: security scan 🔐
37+
# script: npm run test:redos
38+
# node_js: lts/*
3939

4040
cache:
4141
directories:

bin/marked

+17-17
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
* Copyright (c) 2011-2013, Christopher Jeffrey (MIT License)
66
*/
77

8-
var fs = require('fs'),
9-
path = require('path'),
10-
marked = require('../');
8+
const fs = require('fs'),
9+
path = require('path'),
10+
marked = require('../');
1111

1212
/**
1313
* Man Page
1414
*/
1515

1616
function help() {
17-
var spawn = require('child_process').spawn;
17+
const spawn = require('child_process').spawn;
1818

19-
var options = {
19+
const options = {
2020
cwd: process.cwd(),
2121
env: process.env,
2222
setsid: false,
@@ -33,7 +33,7 @@ function help() {
3333
}
3434

3535
function version() {
36-
var pkg = require('../package.json');
36+
const pkg = require('../package.json');
3737
console.log(pkg.version);
3838
}
3939

@@ -42,17 +42,17 @@ function version() {
4242
*/
4343

4444
function main(argv, callback) {
45-
var files = [],
46-
options = {},
47-
input,
48-
output,
49-
string,
50-
arg,
51-
tokens,
52-
opt;
45+
const files = [],
46+
options = {};
47+
let input,
48+
output,
49+
string,
50+
arg,
51+
tokens,
52+
opt;
5353

5454
function getarg() {
55-
var arg = argv.shift();
55+
let arg = argv.shift();
5656

5757
if (arg.indexOf('--') === 0) {
5858
// e.g. --opt
@@ -162,8 +162,8 @@ function main(argv, callback) {
162162
*/
163163

164164
function getStdin(callback) {
165-
var stdin = process.stdin,
166-
buff = '';
165+
const stdin = process.stdin;
166+
let buff = '';
167167

168168
stdin.setEncoding('utf8');
169169

docs/.eslintrc.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"extends": "standard",
3+
"plugins": [
4+
"standard"
5+
],
6+
"parserOptions": {
7+
"ecmaVersion": 5,
8+
"sourceType": "script"
9+
},
10+
"rules": {
11+
"semi": ["error", "always"],
12+
"indent": ["error", 2, {
13+
"SwitchCase": 1,
14+
"VariableDeclarator": { "var": 2 },
15+
"outerIIFEBody": 0
16+
}],
17+
"operator-linebreak": ["error", "before", { "overrides": { "=": "after" } }],
18+
"space-before-function-paren": ["error", "never"],
19+
"no-cond-assign": "off",
20+
"no-useless-escape": "off",
21+
"one-var": "off",
22+
"no-control-regex": "off",
23+
"no-prototype-builtins": "off",
24+
25+
"prefer-const": "off",
26+
"no-var": "off"
27+
},
28+
"env": {
29+
"node": true,
30+
"browser": true,
31+
"amd": true
32+
}
33+
}

docs/AUTHORS.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Authors
22

3-
Marked takes an encompassing approach to its community. As such, you can think of these as [concentric circles](https://medium.com/the-node-js-collection/healthy-open-source-967fa8be7951), where each group encompases the following groups.
3+
Marked takes an encompassing approach to its community. As such, you can think of these as [concentric circles](https://medium.com/the-node-js-collection/healthy-open-source-967fa8be7951), where each group encompasses the following groups.
44

55
<table>
66
<tbody>
@@ -170,7 +170,7 @@ To be removed: You can remove yourself through the [GitHub UI](https://help.gith
170170
A note on volunteering:
171171

172172
1. Please do not volunteer unless you believe you can demonstrate to your peers you can do the work required.
173-
2. Please do not overcommit yourself; we count on those committed to the project to be responsive. Really consider, with all you have going on, wehther you able to really commit to it.
173+
2. Please do not overcommit yourself; we count on those committed to the project to be responsive. Really consider, with all you have going on, whether you able to really commit to it.
174174
3. Don't let the previous frighten you away, it can always be changed later by you or your peers.
175175

176176
[Details on badges](#badges)
@@ -227,7 +227,7 @@ Badges? If you *want* 'em, we got 'em, and here's how you get 'em (and&hellip;dr
227227
</blockquote>
228228
</dd>
229229
<dt>Dr. Docs</dt>
230-
<dd>Someone who has contributed a great deal to the creation and maintainance of the non-code areas of marked.</dd>
230+
<dd>Someone who has contributed a great deal to the creation and maintenance of the non-code areas of marked.</dd>
231231
<dt>Eye for the CLI</dt>
232232
<dd>At this point? Pretty much anyone who can update that `man` file to the current Marked version without regression in the CLI tool itself.</dd>
233233
<dt>GitHub Guru</dt>
@@ -259,9 +259,9 @@ Badges? If you *want* 'em, we got 'em, and here's how you get 'em (and&hellip;dr
259259

260260
<dl>
261261
<dt>Defibrillator</dt>
262-
<dd>A contributor who stepped up to help bring Marked back to life by contriuting solutions to help Marked pass when compared against the CommonMark and GitHub Flavored Markdown specifications.</dd>
262+
<dd>A contributor who stepped up to help bring Marked back to life by contributing solutions to help Marked pass when compared against the CommonMark and GitHub Flavored Markdown specifications.</dd>
263263
<dt>Maker of the Marked mark</dt>
264-
<dd>This badge is given to the person or oganization credited with creating the logo (or logotype) used in Marked communications for a given period of time. **Maker of the Marked mark from 2017 to present**, for example.</dd>
264+
<dd>This badge is given to the person or organization credited with creating the logo (or logotype) used in Marked communications for a given period of time. **Maker of the Marked mark from 2017 to present**, for example.</dd>
265265
<dt>Release Wrangler</dt>
266266
<dd>This is a badge given to all Publishers.</dd>
267267
<dt>Snyk's Security Saint</dt>

docs/CONTRIBUTING.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
- [ ] Make sure you are on the `master` branch.
66
- [ ] Be sure to run `npm install` or `npm update`.
77
- [ ] Create a branch.
8-
- [ ] Make as small a change as possible.
9-
- [ ] Run `npm test`, fix any broken things (for linting, you can run `npm run lint` to have the linter fix them for you).
10-
- [ ] Submit a PR.
8+
- [ ] Update code in `src` folder. (`lib` folder is for auto compiled code)
9+
- [ ] Run `npm run test:all`, fix any broken things (for linting, you can run `npm run lint` to have the linter fix them for you).
10+
- [ ] Run `npm run build:reset` to remove changes to compiled files.
11+
- [ ] Submit a Pull Request.
1112

1213
## Design principles
1314

@@ -30,6 +31,7 @@ The following table lists the ticket type labels we use when there is work to be
3031
|RR - refactor and re-engineer |Results in an improvement to developers using Marked (improved readability) or end-users (faster performance) or both. |
3132
|NFS - new feature (spec related) |A capability Marked does not currently provide but is in one of the [supported specifications](#/README.md#specifications) |
3233
|NFU - new feature (user requested) |A capability Marked does not currently provide but has been requested by users of Marked. |
34+
|NFE - new feature (should be an extension) |A capability Marked does not currently provide and is not part of a spec. |
3335

3436
## Test early, often, and everything
3537

@@ -86,9 +88,8 @@ To check for (and fix) standardized syntax (lint):
8688
npm run lint
8789
```
8890

89-
To build your own minified version of Marked:
91+
To build your own es5, esm, and minified versions of Marked:
9092

9193
```bash
9294
npm run build
9395
```
94-

docs/PUBLISHING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
## Overall strategy
99

10-
**Master is always shippable:** We try to merge PRs in such a way that `master` is the only branch to really be concerned about *and* `master` can always be released. This allows smoother flow between new fetures, bug fixes, and so on. (Almost a continuous deployment setup, without automation.)
10+
**Master is always shippable:** We try to merge PRs in such a way that `master` is the only branch to really be concerned about *and* `master` can always be released. This allows smoother flow between new features, bug fixes, and so on. (Almost a continuous deployment setup, without automation.)
1111

1212
## Versioning
1313

@@ -20,5 +20,5 @@ We follow [semantic versioning](https://semver.org) where the following sequence
2020
What to expect while Marked is a zero-major (0.x.y):
2121

2222
1. The major will remain at zero; thereby, alerting consumers to the potentially volatile nature of the package.
23-
2. The minor will tend to be more analagous to a `major` release.
24-
3. The patch will tend to be more analagous to a `minor` release or a collection of bug fixes (patches).
23+
2. The minor will tend to be more analogous to a `major` release.
24+
3. The patch will tend to be more analogous to a `minor` release or a collection of bug fixes (patches).

docs/USING_ADVANCED.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ console.log(marked(markdownString));
4040

4141
|Member |Type |Default |Since |Notes |
4242
|:-----------|:---------|:--------|:--------|:-------------|
43-
|baseUrl |`string` |`null` |0.3.9 |A prefix url for any relative link. |
43+
|baseUrl |`string` |`null` |0.3.9 |A prefix url for any relative link. |
4444
|breaks |`boolean` |`false` |v0.2.7 |If true, add `<br>` on a single line break (copies GitHub). Requires `gfm` be `true`.|
4545
|gfm |`boolean` |`true` |v0.2.1 |If true, use approved [GitHub Flavored Markdown (GFM) specification](https://github.github.com/gfm/).|
4646
|headerIds |`boolean` |`true` |v0.4.0 |If true, include an `id` attribute when emitting headings (h1, h2, h3, etc).|

docs/USING_PRO.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ You also have direct access to the lexer and parser if you so desire.
106106

107107
``` js
108108
const tokens = marked.lexer(text, options);
109-
console.log(marked.parser(tokens));
109+
console.log(marked.parser(tokens, options));
110110
```
111111

112112
``` js

0 commit comments

Comments
 (0)