Skip to content

Commit

Permalink
Merge pull request markedjs#1563 from UziTech/rollup
Browse files Browse the repository at this point in the history
Separate marked into modules
  • Loading branch information
UziTech committed Dec 4, 2019
2 parents 64b34ad + 961883a commit 583fa34
Show file tree
Hide file tree
Showing 30 changed files with 6,853 additions and 1,766 deletions.
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'),
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

0 comments on commit 583fa34

Please sign in to comment.