Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: markedjs/marked
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.0
Choose a base ref
...
head repository: markedjs/marked
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.0.1
Choose a head ref
  • 19 commits
  • 14 files changed
  • 4 contributors

Commits on Feb 8, 2021

  1. 1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3ad3b10 View commit details
  2. chore(deps-dev): Bump @babel/preset-env from 7.12.11 to 7.12.13 (#1929)

    Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.12.11 to 7.12.13.
    - [Release notes](https://github.com/babel/babel/releases)
    - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
    - [Commits](https://github.com/babel/babel/commits/v7.12.13/packages/babel-preset-env)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 8, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3091be5 View commit details
  3. chore(deps-dev): Bump rollup from 2.38.3 to 2.38.5 (#1931)

    Bumps [rollup](https://github.com/rollup/rollup) from 2.38.3 to 2.38.5.
    - [Release notes](https://github.com/rollup/rollup/releases)
    - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
    - [Commits](rollup/rollup@v2.38.3...v2.38.5)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 8, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d1bb688 View commit details
  4. chore(deps-dev): Bump uglify-js from 3.12.6 to 3.12.7 (#1932)

    Bumps [uglify-js](https://github.com/mishoo/UglifyJS) from 3.12.6 to 3.12.7.
    - [Release notes](https://github.com/mishoo/UglifyJS/releases)
    - [Commits](mishoo/UglifyJS@v3.12.6...v3.12.7)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 8, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    bfa43ca View commit details
  5. chore(deps-dev): Bump @babel/core from 7.12.10 to 7.12.13 (#1930)

    Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.12.10 to 7.12.13.
    - [Release notes](https://github.com/babel/babel/releases)
    - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
    - [Commits](https://github.com/babel/babel/commits/v7.12.13/packages/babel-core)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 8, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    11f93fa View commit details

Commits on Feb 15, 2021

  1. chore(deps-dev): Bump rollup from 2.38.5 to 2.39.0 (#1943)

    Bumps [rollup](https://github.com/rollup/rollup) from 2.38.5 to 2.39.0.
    - [Release notes](https://github.com/rollup/rollup/releases)
    - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
    - [Commits](rollup/rollup@v2.38.5...v2.39.0)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 15, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e801b5e View commit details
  2. chore(deps-dev): Bump @babel/preset-env from 7.12.13 to 7.12.16 (#1942)

    Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.12.13 to 7.12.16.
    - [Release notes](https://github.com/babel/babel/releases)
    - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
    - [Commits](https://github.com/babel/babel/commits/v7.12.16/packages/babel-preset-env)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 15, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    530e38b View commit details
  3. chore(deps-dev): Bump uglify-js from 3.12.7 to 3.12.8 (#1941)

    Bumps [uglify-js](https://github.com/mishoo/UglifyJS) from 3.12.7 to 3.12.8.
    - [Release notes](https://github.com/mishoo/UglifyJS/releases)
    - [Commits](mishoo/UglifyJS@v3.12.7...v3.12.8)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 15, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8fff7af View commit details
  4. chore(deps-dev): Bump @rollup/plugin-babel from 5.2.3 to 5.3.0 (#1946)

    Bumps [@rollup/plugin-babel](https://github.com/rollup/plugins) from 5.2.3 to 5.3.0.
    - [Release notes](https://github.com/rollup/plugins/releases)
    - [Commits](rollup/plugins@babel-v5.2.3...babel-v5.3.0)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 15, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b4bf643 View commit details
  5. chore(deps-dev): Bump @babel/core from 7.12.13 to 7.12.16 (#1940)

    Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.12.13 to 7.12.16.
    - [Release notes](https://github.com/babel/babel/releases)
    - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
    - [Commits](https://github.com/babel/babel/commits/v7.12.16/packages/babel-core)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 15, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    26faccf View commit details
  6. chore(deps-dev): Bump eslint-plugin-promise from 4.2.1 to 4.3.1 (#1939)

    Bumps [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise) from 4.2.1 to 4.3.1.
    - [Release notes](https://github.com/xjamundx/eslint-plugin-promise/releases)
    - [Changelog](https://github.com/xjamundx/eslint-plugin-promise/blob/development/CHANGELOG.md)
    - [Commits](eslint-community/eslint-plugin-promise@v4.2.1...v4.3.1)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 15, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2b1394b View commit details
  7. chore(deps-dev): Bump semantic-release from 17.3.7 to 17.3.9 (#1944)

    Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 17.3.7 to 17.3.9.
    - [Release notes](https://github.com/semantic-release/semantic-release/releases)
    - [Commits](semantic-release/semantic-release@v17.3.7...v17.3.9)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 15, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    98007fc View commit details
  8. chore(deps-dev): Bump eslint from 7.19.0 to 7.20.0 (#1945)

    Bumps [eslint](https://github.com/eslint/eslint) from 7.19.0 to 7.20.0.
    - [Release notes](https://github.com/eslint/eslint/releases)
    - [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
    - [Commits](eslint/eslint@v7.19.0...v7.20.0)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 15, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d2347e9 View commit details

Commits on Feb 19, 2021

  1. docs: warn about broken inline latex example (#1949)

    The docs don't mention how the latex example won't actually work with inline latex, ie. `foo $bar$ baz`
    UlisseMini authored Feb 19, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    29dbc21 View commit details

Commits on Feb 22, 2021

  1. chore(deps-dev): Bump highlight.js from 10.5.0 to 10.6.0 (#1950)

    Bumps [highlight.js](https://github.com/highlightjs/highlight.js) from 10.5.0 to 10.6.0.
    - [Release notes](https://github.com/highlightjs/highlight.js/releases)
    - [Changelog](https://github.com/highlightjs/highlight.js/blob/master/CHANGES.md)
    - [Commits](highlightjs/highlight.js@10.5.0...10.6.0)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 22, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    de8426e View commit details
  2. chore(deps-dev): Bump @babel/preset-env from 7.12.16 to 7.12.17 (#1951)

    Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.12.16 to 7.12.17.
    - [Release notes](https://github.com/babel/babel/releases)
    - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
    - [Commits](https://github.com/babel/babel/commits/v7.12.17/packages/babel-preset-env)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 22, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f21d538 View commit details
  3. chore(deps-dev): Bump @babel/core from 7.12.16 to 7.12.17 (#1952)

    Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.12.16 to 7.12.17.
    - [Release notes](https://github.com/babel/babel/releases)
    - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
    - [Commits](https://github.com/babel/babel/commits/v7.12.17/packages/babel-core)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 22, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    18207d1 View commit details

Commits on Feb 27, 2021

  1. 1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    46cdfc1 View commit details
  2. chore(release): 2.0.1 [skip ci]

    ## [2.0.1](v2.0.0...v2.0.1) (2021-02-27)
    
    ### Bug Fixes
    
    * fix items between lists ([#1936](#1936)) ([46cdfc1](46cdfc1))
    semantic-release-bot committed Feb 27, 2021
    1
    Copy the full SHA
    f5ebaac View commit details
4 changes: 2 additions & 2 deletions docs/USING_PRO.md
Original file line number Diff line number Diff line change
@@ -153,6 +153,7 @@ console.log(marked('$ latex code $\n\n` other code `'));
<p><code>latex code</code></p>
<p><code>other code</code></p>
```
**NOTE**: This does not fully support latex, see issue [#1948](https://github.com/markedjs/marked/issues/1948).

### Block level tokenizer methods

@@ -177,8 +178,7 @@ console.log(marked('$ latex code $\n\n` other code `'));
- tag(*string* src, *bool* inLink, *bool* inRawBlock)
- link(*string* src)
- reflink(*string* src, *object* links)
- strong(*string* src)
- em(*string* src)
- emStrong(*string* src, *string* maskedSrc, *string* prevChar)
- codespan(*string* src)
- br(*string* src)
- del(*string* src)
54 changes: 36 additions & 18 deletions lib/marked.esm.js
Original file line number Diff line number Diff line change
@@ -532,39 +532,51 @@ var Tokenizer_1 = class Tokenizer {
addBack,
loose,
istask,
ischecked;
ischecked,
endMatch;

let l = itemMatch.length;
bcurr = this.rules.block.listItemStart.exec(itemMatch[0]);
for (let i = 0; i < l; i++) {
item = itemMatch[i];
raw = item;

if (!this.options.pedantic) {
// Determine if current item contains the end of the list
endMatch = item.match(new RegExp('\\n\\s*\\n {0,' + (bcurr[0].length - 1) + '}\\S'));
if (endMatch) {
addBack = item.length - endMatch.index + itemMatch.slice(i + 1).join('\n').length;
list.raw = list.raw.substring(0, list.raw.length - addBack);

item = item.substring(0, endMatch.index);
raw = item;
l = i + 1;
}
}

// Determine whether the next list item belongs here.
// Backpedal if it does not belong in this list.
if (i !== l - 1) {
bnext = this.rules.block.listItemStart.exec(itemMatch[i + 1]);
if (
!this.options.pedantic
? bnext[1].length > bcurr[0].length || bnext[1].length > 3
? bnext[1].length >= bcurr[0].length || bnext[1].length > 3
: bnext[1].length > bcurr[1].length
) {
// nested list
itemMatch.splice(i, 2, itemMatch[i] + '\n' + itemMatch[i + 1]);
// nested list or continuation
itemMatch.splice(i, 2, itemMatch[i] + (!this.options.pedantic && bnext[1].length < bcurr[0].length && !itemMatch[i].match(/\n$/) ? '' : '\n') + itemMatch[i + 1]);
i--;
l--;
continue;
} else {
if (
// different bullet style
!this.options.pedantic || this.options.smartLists
? bnext[2][bnext[2].length - 1] !== bull[bull.length - 1]
: isordered === (bnext[2].length === 1)
) {
addBack = itemMatch.slice(i + 1).join('\n');
list.raw = list.raw.substring(0, list.raw.length - addBack.length);
i = l - 1;
}
} else if (
// different bullet style
!this.options.pedantic || this.options.smartLists
? bnext[2][bnext[2].length - 1] !== bull[bull.length - 1]
: isordered === (bnext[2].length === 1)
) {
addBack = itemMatch.slice(i + 1).join('\n').length;
list.raw = list.raw.substring(0, list.raw.length - addBack);
i = l - 1;
}
bcurr = bnext;
}
@@ -583,12 +595,18 @@ var Tokenizer_1 = class Tokenizer {
: item.replace(/^ {1,4}/gm, '');
}

// trim item newlines at end
item = rtrim$1(item, '\n');
if (i !== l - 1) {
raw = raw + '\n';
}

// Determine whether item is loose or not.
// Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
// for discount behavior.
loose = next || /\n\n(?!\s*$)/.test(item);
loose = next || /\n\n(?!\s*$)/.test(raw);
if (i !== l - 1) {
next = item.charAt(item.length - 1) === '\n';
next = raw.slice(-2) === '\n\n';
if (!loose) loose = next;
}

@@ -1072,7 +1090,7 @@ block.item = edit$1(block.item, 'gm')
.replace(/bull/g, block.bullet)
.getRegex();

block.listItemStart = edit$1(/^( *)(bull)/)
block.listItemStart = edit$1(/^( *)(bull) */)
.replace('bull', block.bullet)
.getRegex();

50 changes: 35 additions & 15 deletions lib/marked.js
Original file line number Diff line number Diff line change
@@ -631,31 +631,44 @@
addBack,
loose,
istask,
ischecked;
ischecked,
endMatch;
var l = itemMatch.length;
bcurr = this.rules.block.listItemStart.exec(itemMatch[0]);

for (var i = 0; i < l; i++) {
item = itemMatch[i];
raw = item; // Determine whether the next list item belongs here.
raw = item;

if (!this.options.pedantic) {
// Determine if current item contains the end of the list
endMatch = item.match(new RegExp('\\n\\s*\\n {0,' + (bcurr[0].length - 1) + '}\\S'));

if (endMatch) {
addBack = item.length - endMatch.index + itemMatch.slice(i + 1).join('\n').length;
list.raw = list.raw.substring(0, list.raw.length - addBack);
item = item.substring(0, endMatch.index);
raw = item;
l = i + 1;
}
} // Determine whether the next list item belongs here.
// Backpedal if it does not belong in this list.


if (i !== l - 1) {
bnext = this.rules.block.listItemStart.exec(itemMatch[i + 1]);

if (!this.options.pedantic ? bnext[1].length > bcurr[0].length || bnext[1].length > 3 : bnext[1].length > bcurr[1].length) {
// nested list
itemMatch.splice(i, 2, itemMatch[i] + '\n' + itemMatch[i + 1]);
if (!this.options.pedantic ? bnext[1].length >= bcurr[0].length || bnext[1].length > 3 : bnext[1].length > bcurr[1].length) {
// nested list or continuation
itemMatch.splice(i, 2, itemMatch[i] + (!this.options.pedantic && bnext[1].length < bcurr[0].length && !itemMatch[i].match(/\n$/) ? '' : '\n') + itemMatch[i + 1]);
i--;
l--;
continue;
} else {
if ( // different bullet style
!this.options.pedantic || this.options.smartLists ? bnext[2][bnext[2].length - 1] !== bull[bull.length - 1] : isordered === (bnext[2].length === 1)) {
addBack = itemMatch.slice(i + 1).join('\n');
list.raw = list.raw.substring(0, list.raw.length - addBack.length);
i = l - 1;
}
} else if ( // different bullet style
!this.options.pedantic || this.options.smartLists ? bnext[2][bnext[2].length - 1] !== bull[bull.length - 1] : isordered === (bnext[2].length === 1)) {
addBack = itemMatch.slice(i + 1).join('\n').length;
list.raw = list.raw.substring(0, list.raw.length - addBack);
i = l - 1;
}

bcurr = bnext;
@@ -670,15 +683,22 @@
if (~item.indexOf('\n ')) {
space -= item.length;
item = !this.options.pedantic ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') : item.replace(/^ {1,4}/gm, '');
} // trim item newlines at end


item = rtrim$1(item, '\n');

if (i !== l - 1) {
raw = raw + '\n';
} // Determine whether item is loose or not.
// Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
// for discount behavior.


loose = next || /\n\n(?!\s*$)/.test(item);
loose = next || /\n\n(?!\s*$)/.test(raw);

if (i !== l - 1) {
next = item.charAt(item.length - 1) === '\n';
next = raw.slice(-2) === '\n\n';
if (!loose) loose = next;
}

@@ -1179,7 +1199,7 @@
block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
block.item = /^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/;
block.item = edit$1(block.item, 'gm').replace(/bull/g, block.bullet).getRegex();
block.listItemStart = edit$1(/^( *)(bull)/).replace('bull', block.bullet).getRegex();
block.listItemStart = edit$1(/^( *)(bull) */).replace('bull', block.bullet).getRegex();
block.list = edit$1(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
Loading