Socket
Socket
Sign inDemoInstall

markdown-it

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-it - npm Package Compare versions

Comparing version 9.1.0 to 10.0.0

463

CHANGELOG.md

@@ -1,10 +0,29 @@

9.1.0 / 2019-08-11
------------------
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [10.0.0] - 2019-09-11
### Security
- Fix quadratic parse time for some combinations of pairs, #583. Algorithm is
now similar to one in reference implementation.
### Changed
- Minor internal structs change, to make pairs parse more effective (cost is
linear now). If you use external "pairs" extensions, you need sync those with
"official ones". Without update, old code will work, but can cause invalid
result in rare case. This is the only reason of major version bump. With high probability you don't need to change your code, only update version dependency.
- Updated changelog format.
- Deps bump.
## [9.1.0] - 2019-08-11
### Changed
- Remove extra characters from line break check. Leave only 0x0A & 0x0D, as in
CommonMark spec, #581.
9.0.0 / 2019-07-09
------------------
## [9.0.0] - 2019-07-09
### Changed
- Updated CM spec compatibility to 0.29.

@@ -15,57 +34,52 @@ - Update Travis-CI node version to actual (8 & latest).

8.4.2 / 2018-02-15
------------------
## [8.4.2] - 2018-02-15
### Fixed
- Fix `--no-html` CLI option, #476.
8.4.1 / 2018-02-15
------------------
## [8.4.1] - 2018-02-15
### Fixed
- Fix smartquotes around softbreaks, #430.
8.4.0 / 2017-08-24
------------------
## [8.4.0] - 2017-08-24
### Changed
- Updated CM spec compatibility to 0.28.
8.3.2 / 2017-08-03
------------------
## [8.3.2] - 2017-08-03
### Fixed
- Fix blockquote termination inside lists, #386.
8.3.1 / 2017-03-06
------------------
## [8.3.1] - 2017-03-06
### Fixed
- Fix blockquote termination by list item, #338.
8.3.0 / 2017-02-16
------------------
## [8.3.0] - 2017-02-16
### Changed
- Remove tabs at the beginning of the line in paragraphs.
- Better error message for bad input type, #324.
### Fixed
- Fix table indentation issues, #325, #224.
- Remove tabs at the beginning of the line in paragraphs.
- Fix blockquote termination inside indented lists, #329.
- Better error message for bad input type, #324.
8.2.2 / 2016-12-15
------------------
## [8.2.2] - 2016-12-15
### Added
- Add `-o` / `--output` option to CLI, #312.
8.2.1 / 2016-12-02
------------------
## [8.2.1] - 2016-12-02
### Fixed
- Add missed h2..h6 to whitelisted block tags.
8.2.0 / 2016-12-01
------------------
## [8.2.0] - 2016-12-01
### Changed
- Updated CM spec compatibility to 0.27 (no significant changes).
- Updated CM spec compatibility to 0.27 (no significant changes).
### Fixed
- Fix backticks handle inside tables, #303.

@@ -76,30 +90,26 @@ - Fix edge case for fenced blocks with `~~~` in info, #301.

8.1.0 / 2016-11-03
------------------
## [8.1.0] - 2016-11-03
### Changed
- Make link parse helpers (`md.helpers`) pluggable, #299.
8.0.1 / 2016-10-18
------------------
## [8.0.1] - 2016-10-18
### Fixed
- Tables: allow tab characters in markup
8.0.0 / 2016-09-16
------------------
- Updated CM spec compatibility to 0.26:
- Two consecutive newlines no longer terminate a list.
- Ordered list terminating a paragraph can now only start with 1.
- Adjust emphasis algorithm (`*foo**bar**baz*` is now parsed as `<strong>`
inside `<em>`).
- Fix tab width calculation inside lists and blockquotes.
## [8.0.0] - 2016-09-16
### Changed
- Benchmarks src cleanup.
- Remove testing in old nodes (but still use es5).
- Updated CM spec compatibility to 0.26 (see list below):
- Two consecutive newlines no longer terminate a list.
- Ordered list terminating a paragraph can now only start with 1.
- Adjust emphasis algorithm (`*foo**bar**baz*` is now parsed as `<strong>`
inside `<em>`).
- Fix tab width calculation inside lists and blockquotes.
7.0.1 / 2016-08-16
------------------
## [7.0.1] - 2016-08-16
### Fixed
- Fence renderer: fix concat of class array, #276.

@@ -110,8 +120,7 @@ - Code renderer: do not render double space before attrs, #275.

7.0.0 / 2016-06-22
------------------
- Bump `linkify-it` dependency to 2.0.0.
- `---` no longer terminates autodetected links by default.
- `md.linkifier.set('---', true)` will return old behaviour.
## [7.0.0] - 2016-06-22
### Changed
- Bump `linkify-it` dependency to 2.0.0. `---` no longer terminates
autodetected links by default. `md.linkifier.set('---', true)` will return old
behaviour.
- Major version bumped, because internals or `linkify-it` was changed.

@@ -122,11 +131,9 @@ You will not be affected anyhow, if not used direct access to

6.1.1 / 2016-06-21
------------------
## [6.1.1] - 2016-06-21
### Changed
- Render `code_inline` & `code_block` attributes if exist.
6.1.0 / 2016-06-19
------------------
## [6.1.0] - 2016-06-19
### Changed
- Updated `fence` renderer to not mutate token. Token stream should be

@@ -136,17 +143,14 @@ immutable after renderer call.

6.0.5 / 2016-06-01
------------------
## [6.0.5] - 2016-06-01
### Fixed
- Process `\r` the same way as `\n` and `\r\n\`, #252.
6.0.4 / 2016-05-30
------------------
## [6.0.4] - 2016-05-30
### Added
- Added `Token.attrGet()` method for convenience, #251.
6.0.3 / 2016-05-30
------------------
## [6.0.3] - 2016-05-30
### Security
- Security fix: possible ReDOS in `linkify-it` (forced bump of `linkify-it` &

@@ -157,20 +161,19 @@ `uc-micro` dependencies). New installs will use fixed packages automatically,

6.0.2 / 2016-05-16
------------------
## [6.0.2] - 2016-05-16
### Fixed
- Fix: should not escape twice content of image alt attribute, #246.
6.0.1 / 2016-04-02
------------------
## [6.0.1] - 2016-04-02
### Fixed
- Improve support of missing values in tables, #224.
6.0.0 / 2016-02-11
------------------
## [6.0.0] - 2016-02-11
### Changed
- Maintenance release. Version bump caused by notable changes in CM spec
(multiline setext headers, no spaces inside links, ...). API was not changed.
- Fit CM 0.24 spec requirements.
### Fixed
- Fixed nesting limit check in inline blocks, #197.

@@ -180,5 +183,4 @@ - Fixed posible tail loss in CLI ouput.

5.1.0 / 2016-01-07
------------------
## [5.1.0] - 2016-01-07
### Added
- Token: added `.attrSet()` & `.attrJoin()` methods.

@@ -188,5 +190,4 @@ - Highlighter: allow wrapper override (if result starts with "<pre").

5.0.3 / 2016-01-04
------------------
## [5.0.3] - 2016-01-04
### Fixed
- Allow single column and mismatched columns count in tables.

@@ -197,17 +198,14 @@ - Smartquotes: take into account adjacent tokens.

5.0.2 / 2015-11-20
------------------
## [5.0.2] - 2015-11-20
### Fixed
- Fix meta information (`token.markup` and `token.info`) for autolink tokens.
5.0.1 / 2015-10-30
------------------
## [5.0.1] - 2015-10-30
### Fixed
- Improved tables compatibility with github, #120.
5.0.0 / 2015-10-05
------------------
## [5.0.0] - 2015-10-05
### Changed
- Internal API change. Due to new CM spec requirements, we had to update

@@ -217,12 +215,13 @@ internals. That should not touch ordinary users, but can affect some external

https://github.com/markdown-it/markdown-it/blob/master/docs/5.0_migration.md.
- Updated CM spec compatibility to 0.22:
- Keep tabs (don't replace with spaces).
- Don't wrap iframes with paragraphs.
- Rewritten emphasis algorithm.
- Updated CM spec compatibility to 0.22 (see list below).
- Keep tabs (don't replace with spaces).
- Don't wrap iframes with paragraphs.
- Rewritten emphasis algorithm.
### Fixed
- Fix closure compiler collisions (don't use reserved words), #159.
4.4.0 / 2015-07-18
------------------
## [4.4.0] - 2015-07-18
### Changed
- Updated HTML blocks logic to CM 0.21 spec.

@@ -232,20 +231,23 @@ - Minor fixes.

4.3.1 / 2015-07-15
------------------
## [4.3.1] - 2015-07-15
### Security
- Fix class name injection in fence renderer.
### Fixed
- Allow numbered lists starting from zero.
- Fix class name injection in fence renderer.
4.3.0 / 2015-06-29
------------------
## [4.3.0] - 2015-06-29
### Changed
- `linkify-it` dependency update (1.2.0). Now accepts dash at the end of links.
4.2.2 / 2015-06-10
------------------
## [4.2.2] - 2015-06-10
### Changed
- CM spec 0.20.
- CM spec 0.20.
### Added
- Added support for multichar substituition in smartquites, #115.
### Fixed
- Fixed code block render inside blockquites, #116.

@@ -255,11 +257,9 @@ - Doc fixes.

4.2.1 / 2015-05-01
------------------
## [4.2.1] - 2015-05-01
### Changed
- Minor emphasis update to match CM spec 0.19.
4.2.0 / 2015-04-21
------------------
## [4.2.0] - 2015-04-21
### Changed
- Bumped [linkify-it](https://github.com/markdown-it/linkify-it) version to

@@ -271,5 +271,4 @@ 1.1.0. Now links with IP hosts and without protocols are not linkified by

4.1.2 / 2015-04-19
------------------
## [4.1.2] - 2015-04-19
### Changed
- Bumped linkifier version. More strict 2-chars tald support for links without

@@ -279,14 +278,14 @@ schema. Should not linkify things like `io.js` and `node.js`.

4.1.1 / 2015-04-15
------------------
## [4.1.1] - 2015-04-15
### Fixed
- Improved pipe chars support in table cells, #86 (thanks to @jbt).
4.1.0 / 2015-03-31
------------------
- Security: disabled `data:` URLs by default (except some image mimes), to avoid
## [4.1.0] - 2015-03-31
### Security
- Disabled `data:` URLs by default (except some image mimes), to avoid
possible XSS. Version bumped, because features changed (formally). If you did
not used `data:` URLs, consider this version as 4.0.4 (no API changes).
### Changed
- Simplified link validator code. Now more easy to understand and to copy

@@ -296,13 +295,13 @@ into your projects for customization.

4.0.3 / 2015-03-25
------------------
## [4.0.3] - 2015-03-25
### Changed
- Updated linkifier.
- Smartquotes rule cleanup (#76).
### Fixed
- Fixed replacements rule bug in PhantomJS (#77).
4.0.2 / 2015-03-22
------------------
## [4.0.2] - 2015-03-22
### Fixed
- Fixed emphasis `marker` fields in tokens (#69).

@@ -312,12 +311,12 @@ - Fixed html block tokens with numbers in name (#74).

4.0.1 / 2015-03-13
------------------
## [4.0.1] - 2015-03-13
### Added
- Added custom container plugin demo.
### Changed
- Updated `linkify-it` version.
- Added custom container plugin demo.
4.0.0 / 2015-03-11
------------------
## [4.0.0] - 2015-03-11
### Changed
- Breaking internal API changes. See [v4 migration notes](https://github.com/markdown-it/markdown-it/blob/master/docs/4.0_migration.md). In usual case you will need to update plugins.

@@ -335,9 +334,13 @@ - Token internals changed

- Use entities data from external package.
### Fixed
- Fixed emphasis regression, caused by CM v0.18 spec (#65).
3.1.0 / 2015-03-05
------------------
## [3.1.0] - 2015-03-05
### Changed
- Spec conformance update to 0.18.
- Significantly improved autolinking quality (use `linkify-it` package), #2.
- Significantly improved autolinking quality (use `linkify-it` package), #2.
### Fixed
- Rewritten links normalizer to solve different edge cases (use `mdurl`

@@ -348,64 +351,67 @@ package), #29.

- Improved smartquotes logic, #61.
- Spec conformance update to 0.18.
3.0.7 / 2015-02-22
------------------
## [3.0.7] - 2015-02-22
### Added
- Added basic CLI support.
- Match table columns count by header.
- Added basic CLI support.
- Added \v \f to valid whitespaces.
### Changed
- Use external package for unicode data (punctuation).
### Fixed
- Added \v \f to valid whitespaces.
- Match table columns count by header.
3.0.6 / 2015-02-12
------------------
## [3.0.6] - 2015-02-12
### Added
- Sync scroll result => source in demo.
### Changed
- Moved `normalizeReference()` to utils.
### Fixed
- Fixed hang on long vertical list of links. Appeared in 3.0.5. See #54 for
details. Thanks to @fengmk2 for report!
- Table lines now can have escaped pipe char `\|` (#5).
- Sync scroll result => source in demo.
- Moved `normalizeReference()` to utils.
3.0.5 / 2015-02-06
------------------
## [3.0.5] - 2015-02-06
### Changed
- Significantly improved tests coverage (with dead code removal and other
related things).
### Fixed
- Fixed link validator - could skip some kind of javascript links with uppercase
digital entities (thanks to @opennota)
- Significantly improved tests coverage (with dead code removal and other
related things).
3.0.4 / 2015-01-13
------------------
## [3.0.4] - 2015-01-13
### Changed
- Improved errors processing in url normalizer (for broken sequences).
- Improved nesting limit processing in inline parser.
- Reorganised tests & improved coverage.
- Reorganized tests & improved coverage.
- Show inline diffs for failed tests.
3.0.3 / 2015-01-11
------------------
## [3.0.3] - 2015-01-11
### Fixed
- Fixed punctuation check in emphasis.
3.0.2 / 2015-01-09
------------------
## [3.0.2] - 2015-01-09
### Fixed
- Allow dashes in HTML tag names (needed for custom HTML tags).
3.0.1 / 2015-01-07
------------------
## [3.0.1] - 2015-01-07
### Changed
- Added # to terminator chars.
### Fixed
- Improved link encoder - fix invalid surrogates to avoid errors.
- Added # to terminator chars.
3.0.0 / 2015-01-04
------------------
## [3.0.0] - 2015-01-04
### Changed
- Big split. All "rare" rules moved to external plugins (deflist, abbr, footnote,

@@ -423,3 +429,2 @@ sub, sup, ins, mark).

be disabled).
- Fixed inline html comments & cdata parse.
- Replace NULL characters with 0xFFFD instead of strip.

@@ -430,17 +435,26 @@ - Removed custom fences sugar (overcomplication).

### Fixed
- Fixed inline html comments & cdata parse.
2.2.1 / 2014-12-29
------------------
## [2.2.1] - 2014-12-29
### Added
- Added development info.
- Fixed line breaks in definitions lists.
### Changed
- .use() now pass any number of params to plugins.
### Fixed
- Fixed line breaks in definitions lists.
2.2.0 / 2014-12-28
------------------
- Updated CM spec conformance to v0.13.
## [2.2.0] - 2014-12-28
### Added
- API docs.
- Added 'zero' preset.
### Changed
- Updated CM spec conformance to v0.13.
### Fixed
- Fixed several crashes, when some basic rules are disabled

@@ -450,6 +464,7 @@ (block termination check, references check).

2.1.3 / 2014-12-24
------------------
## [2.1.3] - 2014-12-24
### Added
- Added curring to `set`/`configure`/`enable`/`disable` methods.
- Added curring to `set`/`configure`/`enable`/`disable` methods.
### Changed
- Demo rework - now can include plugins.

@@ -459,5 +474,4 @@ - Docs update.

2.1.2 / 2014-12-23
------------------
## [2.1.2] - 2014-12-23
### Changed
- Exposed helpers into parser instances (for plugins).

@@ -468,5 +482,4 @@ - Removed utils from global export - been in instances seems enougth.

2.1.1 / 2014-12-22
------------------
## [2.1.1] - 2014-12-22
### Changed
- Refreshed browser builds, missed in prev release.

@@ -476,5 +489,4 @@ - Minor changes.

2.1.0 / 2014-12-21
------------------
## [2.1.0] - 2014-12-21
### Changed
- Separated method to enable rules by whitelist (enableOnly).

@@ -487,7 +499,68 @@ - Changed second param of enable/disable ruler methods.

2.0.0 / 2014-12-20
------------------
## [2.0.0] - 2014-12-20
### Changed
- New project name & home! Now it's `markdown-it`,
- Sugar for constructor call - `new` is not mandatory now.
- Renamed presets folder (configs -> presets).
[10.0.0]: https://github.com/markdown-it/markdown-it/compare/9.1.0...10.0.0
[9.1.0]: https://github.com/markdown-it/markdown-it/compare/9.0.1...9.1.0
[9.0.1]: https://github.com/markdown-it/markdown-it/compare/9.0.0...9.0.1
[9.0.0]: https://github.com/markdown-it/markdown-it/compare/8.4.2...9.0.0
[8.4.2]: https://github.com/markdown-it/markdown-it/compare/8.4.1...8.4.2
[8.4.1]: https://github.com/markdown-it/markdown-it/compare/8.4.0...8.4.1
[8.4.0]: https://github.com/markdown-it/markdown-it/compare/8.3.2...8.4.0
[8.3.2]: https://github.com/markdown-it/markdown-it/compare/8.3.1...8.3.2
[8.3.1]: https://github.com/markdown-it/markdown-it/compare/8.3.0...8.3.1
[8.3.0]: https://github.com/markdown-it/markdown-it/compare/8.2.2...8.3.0
[8.2.2]: https://github.com/markdown-it/markdown-it/compare/8.2.1...8.2.2
[8.2.1]: https://github.com/markdown-it/markdown-it/compare/8.2.0...8.2.1
[8.2.0]: https://github.com/markdown-it/markdown-it/compare/8.1.0...8.2.0
[8.1.0]: https://github.com/markdown-it/markdown-it/compare/8.0.1...8.1.0
[8.0.1]: https://github.com/markdown-it/markdown-it/compare/8.0.0...8.0.1
[8.0.0]: https://github.com/markdown-it/markdown-it/compare/7.0.1...8.0.0
[7.0.1]: https://github.com/markdown-it/markdown-it/compare/7.0.0...7.0.1
[7.0.0]: https://github.com/markdown-it/markdown-it/compare/6.1.1...7.0.0
[6.1.1]: https://github.com/markdown-it/markdown-it/compare/6.1.0...6.1.1
[6.1.0]: https://github.com/markdown-it/markdown-it/compare/6.0.5...6.1.0
[6.0.5]: https://github.com/markdown-it/markdown-it/compare/6.0.4...6.0.5
[6.0.4]: https://github.com/markdown-it/markdown-it/compare/6.0.3...6.0.4
[6.0.3]: https://github.com/markdown-it/markdown-it/compare/6.0.2...6.0.3
[6.0.2]: https://github.com/markdown-it/markdown-it/compare/6.0.1...6.0.2
[6.0.1]: https://github.com/markdown-it/markdown-it/compare/6.0.0...6.0.1
[6.0.0]: https://github.com/markdown-it/markdown-it/compare/5.1.0...6.0.0
[5.1.0]: https://github.com/markdown-it/markdown-it/compare/5.0.3...5.1.0
[5.0.3]: https://github.com/markdown-it/markdown-it/compare/5.0.2...5.0.3
[5.0.2]: https://github.com/markdown-it/markdown-it/compare/5.0.1...5.0.2
[5.0.1]: https://github.com/markdown-it/markdown-it/compare/5.0.0...5.0.1
[5.0.0]: https://github.com/markdown-it/markdown-it/compare/4.4.0...5.0.0
[4.4.0]: https://github.com/markdown-it/markdown-it/compare/4.3.1...4.4.0
[4.3.1]: https://github.com/markdown-it/markdown-it/compare/4.3.0...4.3.1
[4.3.0]: https://github.com/markdown-it/markdown-it/compare/4.2.2...4.3.0
[4.2.2]: https://github.com/markdown-it/markdown-it/compare/4.2.1...4.2.2
[4.2.1]: https://github.com/markdown-it/markdown-it/compare/4.2.0...4.2.1
[4.2.0]: https://github.com/markdown-it/markdown-it/compare/4.1.2...4.2.0
[4.1.2]: https://github.com/markdown-it/markdown-it/compare/4.1.1...4.1.2
[4.1.1]: https://github.com/markdown-it/markdown-it/compare/4.1.0...4.1.1
[4.1.0]: https://github.com/markdown-it/markdown-it/compare/4.0.3...4.1.0
[4.0.3]: https://github.com/markdown-it/markdown-it/compare/4.0.2...4.0.3
[4.0.2]: https://github.com/markdown-it/markdown-it/compare/4.0.1...4.0.2
[4.0.1]: https://github.com/markdown-it/markdown-it/compare/4.0.0...4.0.1
[4.0.0]: https://github.com/markdown-it/markdown-it/compare/3.1.0...4.0.0
[3.1.0]: https://github.com/markdown-it/markdown-it/compare/3.0.7...3.1.0
[3.0.7]: https://github.com/markdown-it/markdown-it/compare/3.0.6...3.0.7
[3.0.6]: https://github.com/markdown-it/markdown-it/compare/3.0.5...3.0.6
[3.0.5]: https://github.com/markdown-it/markdown-it/compare/3.0.4...3.0.5
[3.0.4]: https://github.com/markdown-it/markdown-it/compare/3.0.3...3.0.4
[3.0.3]: https://github.com/markdown-it/markdown-it/compare/3.0.2...3.0.3
[3.0.2]: https://github.com/markdown-it/markdown-it/compare/3.0.1...3.0.2
[3.0.1]: https://github.com/markdown-it/markdown-it/compare/3.0.0...3.0.1
[3.0.0]: https://github.com/markdown-it/markdown-it/compare/2.2.1...3.0.0
[2.2.1]: https://github.com/markdown-it/markdown-it/compare/2.2.0...2.2.1
[2.2.0]: https://github.com/markdown-it/markdown-it/compare/2.1.3...2.2.0
[2.1.3]: https://github.com/markdown-it/markdown-it/compare/2.1.2...2.1.3
[2.1.2]: https://github.com/markdown-it/markdown-it/compare/2.1.1...2.1.2
[2.1.1]: https://github.com/markdown-it/markdown-it/compare/2.1.0...2.1.1
[2.1.0]: https://github.com/markdown-it/markdown-it/compare/2.0.0...2.1.0
[2.0.0]: https://github.com/markdown-it/markdown-it/releases/tag/2.0.0

@@ -6,2 +6,2 @@ // HTML5 entities map: { name -> utf16string }

/*eslint quotes:0*/
module.exports = require('entities/maps/entities.json');
module.exports = require('entities/lib/maps/entities.json');

@@ -6,35 +6,54 @@ // For each opening emphasis-like marker find a matching closing one

module.exports = function link_pairs(state) {
var i, j, lastDelim, currDelim,
delimiters = state.delimiters,
max = state.delimiters.length;
function processDelimiters(state, delimiters) {
var closerIdx, openerIdx, closer, opener, minOpenerIdx, newMinOpenerIdx,
isOddMatch, lastJump,
openersBottom = {},
max = delimiters.length;
for (i = 0; i < max; i++) {
lastDelim = delimiters[i];
for (closerIdx = 0; closerIdx < max; closerIdx++) {
closer = delimiters[closerIdx];
if (!lastDelim.close) { continue; }
// Length is only used for emphasis-specific "rule of 3",
// if it's not defined (in strikethrough or 3rd party plugins),
// we can default it to 0 to disable those checks.
//
closer.length = closer.length || 0;
j = i - lastDelim.jump - 1;
if (!closer.close) continue;
while (j >= 0) {
currDelim = delimiters[j];
// Previously calculated lower bounds (previous fails)
// for each marker and each delimiter length modulo 3.
if (!openersBottom.hasOwnProperty(closer.marker)) {
openersBottom[closer.marker] = [ -1, -1, -1 ];
}
if (currDelim.open &&
currDelim.marker === lastDelim.marker &&
currDelim.end < 0 &&
currDelim.level === lastDelim.level) {
minOpenerIdx = openersBottom[closer.marker][closer.length % 3];
newMinOpenerIdx = -1;
var odd_match = false;
openerIdx = closerIdx - closer.jump - 1;
// typeofs are for backward compatibility with plugins
if ((currDelim.close || lastDelim.open) &&
typeof currDelim.length !== 'undefined' &&
typeof lastDelim.length !== 'undefined') {
for (; openerIdx > minOpenerIdx; openerIdx -= opener.jump + 1) {
opener = delimiters[openerIdx];
// from spec:
// sum of the lengths [...] must not be a multiple of 3
// unless both lengths are multiples of 3
if ((currDelim.length + lastDelim.length) % 3 === 0) {
if (currDelim.length % 3 !== 0 || lastDelim.length % 3 !== 0) {
odd_match = true;
if (opener.marker !== closer.marker) continue;
if (newMinOpenerIdx === -1) newMinOpenerIdx = openerIdx;
if (opener.open &&
opener.end < 0 &&
opener.level === closer.level) {
isOddMatch = false;
// from spec:
//
// If one of the delimiters can both open and close emphasis, then the
// sum of the lengths of the delimiter runs containing the opening and
// closing delimiters must not be a multiple of 3 unless both lengths
// are multiples of 3.
//
if (opener.close || closer.open) {
if ((opener.length + closer.length) % 3 === 0) {
if (opener.length % 3 !== 0 || closer.length % 3 !== 0) {
isOddMatch = true;
}

@@ -44,14 +63,48 @@ }

if (!odd_match) {
lastDelim.jump = i - j;
lastDelim.open = false;
currDelim.end = i;
currDelim.jump = 0;
if (!isOddMatch) {
// If previous delimiter cannot be an opener, we can safely skip
// the entire sequence in future checks. This is required to make
// sure algorithm has linear complexity (see *_*_*_*_*_... case).
//
lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open ?
delimiters[openerIdx - 1].jump + 1 :
0;
closer.jump = closerIdx - openerIdx + lastJump;
closer.open = false;
opener.end = closerIdx;
opener.jump = lastJump;
opener.close = false;
newMinOpenerIdx = -1;
break;
}
}
}
j -= currDelim.jump + 1;
if (newMinOpenerIdx !== -1) {
// If match for this delimiter run failed, we want to set lower bound for
// future lookups. This is required to make sure algorithm has linear
// complexity.
//
// See details here:
// https://github.com/commonmark/cmark/issues/178#issuecomment-270417442
//
openersBottom[closer.marker][(closer.length || 0) % 3] = newMinOpenerIdx;
}
}
}
module.exports = function link_pairs(state) {
var curr,
tokens_meta = state.tokens_meta,
max = state.tokens_meta.length;
processDelimiters(state, state.delimiters);
for (curr = 0; curr < max; curr++) {
if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
processDelimiters(state, tokens_meta[curr].delimiters);
}
}
};

@@ -45,6 +45,2 @@ // Process *this* and _that_

// Token level.
//
level: state.level,
// If this delimiter is matched as a valid opener, `end` will be

@@ -69,5 +65,3 @@ // equal to its position, otherwise it's `-1`.

// Walk through delimiter list and replace text tokens with tags
//
module.exports.postProcess = function emphasis(state) {
function postProcess(state, delimiters) {
var i,

@@ -79,4 +73,3 @@ startDelim,

isStrong,
delimiters = state.delimiters,
max = state.delimiters.length;
max = delimiters.length;

@@ -130,2 +123,19 @@ for (i = max - 1; i >= 0; i--) {

}
}
// Walk through delimiter list and replace text tokens with tags
//
module.exports.postProcess = function emphasis(state) {
var curr,
tokens_meta = state.tokens_meta,
max = state.tokens_meta.length;
postProcess(state, state.delimiters);
for (curr = 0; curr < max; curr++) {
if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
postProcess(state, tokens_meta[curr].delimiters);
}
}
};

@@ -17,2 +17,3 @@ // Inline parser state

this.tokens = outTokens;
this.tokens_meta = Array(outTokens.length);

@@ -25,6 +26,11 @@ this.pos = 0;

this.cache = {}; // Stores { start: end } pairs. Useful for backtrack
// optimization of pairs parse (emphasis, strikes).
// Stores { start: end } pairs. Useful for backtrack
// optimization of pairs parse (emphasis, strikes).
this.cache = {};
this.delimiters = []; // Emphasis-like delimiters
// List of emphasis-like delimiters for current tag
this.delimiters = [];
// Stack of delimiter lists for upper level tags
this._prev_delimiters = [];
}

@@ -54,9 +60,23 @@

var token = new Token(type, tag, nesting);
var token_meta = null;
if (nesting < 0) this.level--; // closing tag
if (nesting < 0) {
// closing tag
this.level--;
this.delimiters = this._prev_delimiters.pop();
}
token.level = this.level;
if (nesting > 0) this.level++; // opening tag
if (nesting > 0) {
// opening tag
this.level++;
this._prev_delimiters.push(this.delimiters);
this.delimiters = [];
token_meta = { delimiters: this.delimiters };
}
this.pendingLevel = this.level;
this.tokens.push(token);
this.tokens_meta.push(token_meta);
return token;

@@ -63,0 +83,0 @@ };

@@ -35,5 +35,5 @@ // ~~strike through~~

marker: marker,
length: 0, // disable "rule of 3" length checks meant for emphasis
jump: i,
token: state.tokens.length - 1,
level: state.level,
end: -1,

@@ -51,5 +51,3 @@ open: scanned.can_open,

// Walk through delimiter list and replace text tokens with tags
//
module.exports.postProcess = function strikethrough(state) {
function postProcess(state, delimiters) {
var i, j,

@@ -60,4 +58,3 @@ startDelim,

loneMarkers = [],
delimiters = state.delimiters,
max = state.delimiters.length;
max = delimiters.length;

@@ -120,2 +117,19 @@ for (i = 0; i < max; i++) {

}
}
// Walk through delimiter list and replace text tokens with tags
//
module.exports.postProcess = function strikethrough(state) {
var curr,
tokens_meta = state.tokens_meta,
max = state.tokens_meta.length;
postProcess(state, state.delimiters);
for (curr = 0; curr < max; curr++) {
if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
postProcess(state, tokens_meta[curr].delimiters);
}
}
};
{
"name": "markdown-it",
"version": "9.1.0",
"version": "10.0.0",
"description": "Markdown-it - modern pluggable markdown parser.",

@@ -29,3 +29,3 @@ "keywords": [

"argparse": "^1.0.7",
"entities": "~1.1.1",
"entities": "~2.0.0",
"linkify-it": "^2.0.0",

@@ -32,0 +32,0 @@ "mdurl": "^1.0.1",

@@ -20,10 +20,17 @@ # markdown-it

- [Install](#install)
- [Usage examples](#usage-examples)
- [API](#api)
- [Syntax extensions](#syntax-extensions)
- [Benchmark](#benchmark)
- [Authors](#authors)
- [References / Thanks](#references--thanks)
- [License](#license)
- [markdown-it](#markdown-it)
- [Install](#install)
- [Usage examples](#usage-examples)
- [Simple](#simple)
- [Init with presets and options](#init-with-presets-and-options)
- [Plugins load](#plugins-load)
- [Syntax highlighting](#syntax-highlighting)
- [Linkify](#linkify)
- [API](#api)
- [Syntax extensions](#syntax-extensions)
- [Manage rules](#manage-rules)
- [Benchmark](#benchmark)
- [Support markdown-it](#support-markdown-it)
- [Authors](#authors)
- [References / Thanks](#references--thanks)

@@ -266,2 +273,8 @@ ## Install

Support markdown-it
-------------------
You can support this project via [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-markdown-it?utm_source=npm-markdown-it&utm_medium=referral&utm_campaign=readme).
## Authors

@@ -292,6 +305,1 @@

- [motion-markdown-it](https://github.com/digitalmoksha/motion-markdown-it) - Ruby/RubyMotion
## License
[MIT](https://github.com/markdown-it/markdown-it/blob/master/LICENSE)

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc