Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate marked into modules #1563

Merged
merged 33 commits into from Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
099983f
move marked to es modules in ./src folder
UziTech Nov 5, 2019
0957c22
update deps and add rollup and babel
UziTech Nov 5, 2019
3dff1e4
fix eslint config
UziTech Nov 5, 2019
082ad97
run build
UziTech Nov 5, 2019
39dda84
no-ignore test:redos
UziTech Nov 5, 2019
f9f5580
use commonjs and es6 classes
UziTech Nov 6, 2019
2ea16d4
run build
UziTech Nov 6, 2019
a4652f1
add license in rollup
UziTech Nov 6, 2019
83fa297
add npm run build:reset
UziTech Nov 6, 2019
ba45b32
remove test:redos and use es6 in tests
UziTech Nov 6, 2019
c24637b
build `lib/marked.esm.js`
UziTech Nov 6, 2019
c862843
add vuln-regex test
UziTech Nov 6, 2019
28f62c9
include src/ in npm package
UziTech Nov 6, 2019
03c4cbe
fix options not being passed
UziTech Nov 6, 2019
53cc11c
reset esm.js
UziTech Nov 6, 2019
821dabd
save renderer to inlinelexer options
UziTech Nov 6, 2019
9b5cd73
remove bench debugging
UziTech Nov 6, 2019
4ddbe81
fix spelling
UziTech Nov 6, 2019
e13d6f9
add DO NOT EDIT comment in compiled files
UziTech Nov 6, 2019
32d61f4
update docs
UziTech Nov 6, 2019
d979d26
clean up code
UziTech Nov 6, 2019
7b450bd
fix benchmark pass percentage
UziTech Nov 7, 2019
6901937
await engine
UziTech Nov 7, 2019
b01aa4f
clean up code
UziTech Nov 7, 2019
caa362c
commit lib
UziTech Nov 7, 2019
fb80552
rename regex.js to rules.js
UziTech Nov 8, 2019
47efe8e
rename parse argument to tokens
UziTech Nov 8, 2019
a54408f
change minify stage to build
UziTech Nov 8, 2019
2b531af
update engines
UziTech Nov 8, 2019
4736f3e
Update copyright year
UziTech Nov 11, 2019
a8730bf
update copyright year
UziTech Nov 11, 2019
aae38bb
remove security scan
UziTech Nov 27, 2019
2571795
build marked.js
UziTech Nov 27, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
@@ -1 +1,2 @@
lib
*.min.js
13 changes: 5 additions & 8 deletions .eslintrc.json
Expand Up @@ -3,10 +3,6 @@
"plugins": [
"standard"
],
"parserOptions": {
"ecmaVersion": 5,
"sourceType": "script"
},
"rules": {
"semi": ["error", "always"],
"indent": ["error", 2, {
Expand All @@ -20,11 +16,12 @@
"no-useless-escape": "off",
"one-var": "off",
"no-control-regex": "off",
"no-prototype-builtins": "off"
"no-prototype-builtins": "off",

"prefer-const": "error",
"no-var": "error"
},
"env": {
"node": true,
"browser": true,
"amd": true
"node": true
}
}
10 changes: 5 additions & 5 deletions .travis.yml
Expand Up @@ -19,23 +19,23 @@ jobs:
script: npm run test:lint
node_js: lts/*

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

- stage: security scan 🔐
script: npm run test:redos
node_js: lts/*
# - stage: security scan 🔐
# script: npm run test:redos
# node_js: lts/*

cache:
directories:
Expand Down
34 changes: 17 additions & 17 deletions bin/marked
Expand Up @@ -5,18 +5,18 @@
* Copyright (c) 2011-2013, Christopher Jeffrey (MIT License)
*/

var fs = require('fs'),
path = require('path'),
marked = require('../');
const fs = require('fs'),
styfle marked this conversation as resolved.
Show resolved Hide resolved
path = require('path'),
marked = require('../');

/**
* Man Page
*/

function help() {
var spawn = require('child_process').spawn;
const spawn = require('child_process').spawn;

var options = {
const options = {
cwd: process.cwd(),
env: process.env,
setsid: false,
Expand All @@ -33,7 +33,7 @@ function help() {
}

function version() {
var pkg = require('../package.json');
const pkg = require('../package.json');
console.log(pkg.version);
}

Expand All @@ -42,17 +42,17 @@ function version() {
*/

function main(argv, callback) {
var files = [],
options = {},
input,
output,
string,
arg,
tokens,
opt;
const files = [],
options = {};
let input,
output,
string,
arg,
tokens,
opt;

function getarg() {
var arg = argv.shift();
let arg = argv.shift();

if (arg.indexOf('--') === 0) {
// e.g. --opt
Expand Down Expand Up @@ -162,8 +162,8 @@ function main(argv, callback) {
*/

function getStdin(callback) {
var stdin = process.stdin,
buff = '';
const stdin = process.stdin;
let buff = '';

stdin.setEncoding('utf8');

Expand Down
33 changes: 33 additions & 0 deletions docs/.eslintrc.json
@@ -0,0 +1,33 @@
{
"extends": "standard",
"plugins": [
"standard"
],
"parserOptions": {
"ecmaVersion": 5,
"sourceType": "script"
},
"rules": {
"semi": ["error", "always"],
"indent": ["error", 2, {
"SwitchCase": 1,
"VariableDeclarator": { "var": 2 },
"outerIIFEBody": 0
}],
"operator-linebreak": ["error", "before", { "overrides": { "=": "after" } }],
"space-before-function-paren": ["error", "never"],
"no-cond-assign": "off",
"no-useless-escape": "off",
"one-var": "off",
"no-control-regex": "off",
"no-prototype-builtins": "off",

"prefer-const": "off",
"no-var": "off"
},
"env": {
"node": true,
"browser": true,
"amd": true
}
}
10 changes: 5 additions & 5 deletions docs/AUTHORS.md
@@ -1,6 +1,6 @@
# Authors

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.
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.

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

1. Please do not volunteer unless you believe you can demonstrate to your peers you can do the work required.
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.
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.
3. Don't let the previous frighten you away, it can always be changed later by you or your peers.

[Details on badges](#badges)
Expand Down Expand Up @@ -227,7 +227,7 @@ Badges? If you *want* 'em, we got 'em, and here's how you get 'em (and&hellip;dr
</blockquote>
</dd>
<dt>Dr. Docs</dt>
<dd>Someone who has contributed a great deal to the creation and maintainance of the non-code areas of marked.</dd>
<dd>Someone who has contributed a great deal to the creation and maintenance of the non-code areas of marked.</dd>
<dt>Eye for the CLI</dt>
<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>
<dt>GitHub Guru</dt>
Expand Down Expand Up @@ -259,9 +259,9 @@ Badges? If you *want* 'em, we got 'em, and here's how you get 'em (and&hellip;dr

<dl>
<dt>Defibrillator</dt>
<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>
<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>
<dt>Maker of the Marked mark</dt>
<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>
<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>
<dt>Release Wrangler</dt>
<dd>This is a badge given to all Publishers.</dd>
<dt>Snyk's Security Saint</dt>
Expand Down
11 changes: 6 additions & 5 deletions docs/CONTRIBUTING.md
Expand Up @@ -5,9 +5,10 @@
- [ ] Make sure you are on the `master` branch.
- [ ] Be sure to run `npm install` or `npm update`.
- [ ] Create a branch.
- [ ] Make as small a change as possible.
- [ ] Run `npm test`, fix any broken things (for linting, you can run `npm run lint` to have the linter fix them for you).
- [ ] Submit a PR.
- [ ] Update code in `src` folder. (`lib` folder is for auto compiled code)
- [ ] 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).
- [ ] Run `npm run build:reset` to remove changes to compiled files.
- [ ] Submit a Pull Request.

## Design principles

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

## Test early, often, and everything

Expand Down Expand Up @@ -86,9 +88,8 @@ To check for (and fix) standardized syntax (lint):
npm run lint
```

To build your own minified version of Marked:
To build your own es5, esm, and minified versions of Marked:

```bash
npm run build
```

6 changes: 3 additions & 3 deletions docs/PUBLISHING.md
Expand Up @@ -7,7 +7,7 @@

## Overall strategy

**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.)
**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.)

## Versioning

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

1. The major will remain at zero; thereby, alerting consumers to the potentially volatile nature of the package.
2. The minor will tend to be more analagous to a `major` release.
3. The patch will tend to be more analagous to a `minor` release or a collection of bug fixes (patches).
2. The minor will tend to be more analogous to a `major` release.
3. The patch will tend to be more analogous to a `minor` release or a collection of bug fixes (patches).
2 changes: 1 addition & 1 deletion docs/USING_ADVANCED.md
Expand Up @@ -40,7 +40,7 @@ console.log(marked(markdownString));

|Member |Type |Default |Since |Notes |
|:-----------|:---------|:--------|:--------|:-------------|
|baseUrl |`string` |`null` |0.3.9 |A prefix url for any relative link. |
|baseUrl |`string` |`null` |0.3.9 |A prefix url for any relative link. |
|breaks |`boolean` |`false` |v0.2.7 |If true, add `<br>` on a single line break (copies GitHub). Requires `gfm` be `true`.|
|gfm |`boolean` |`true` |v0.2.1 |If true, use approved [GitHub Flavored Markdown (GFM) specification](https://github.github.com/gfm/).|
|headerIds |`boolean` |`true` |v0.4.0 |If true, include an `id` attribute when emitting headings (h1, h2, h3, etc).|
Expand Down
2 changes: 1 addition & 1 deletion docs/USING_PRO.md
Expand Up @@ -106,7 +106,7 @@ You also have direct access to the lexer and parser if you so desire.

``` js
const tokens = marked.lexer(text, options);
console.log(marked.parser(tokens));
console.log(marked.parser(tokens, options));
```

``` js
Expand Down