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 8.4.2 to 9.0.0

8

CHANGELOG.md

@@ -0,1 +1,9 @@

9.0.0 / 2019-07-09
------------------
- Updated CM spec compatibility to 0.29.
- Update Travis-CI node version to actual (8 & latest).
- Deps bump.
8.4.2 / 2018-02-15

@@ -2,0 +10,0 @@ ------------------

31

lib/common/utils.js

@@ -91,5 +91,4 @@ // Utilities

code = name[1].toLowerCase() === 'x' ?
parseInt(name.slice(2), 16)
:
parseInt(name.slice(1), 10);
parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);
if (isValidEntityCode(code)) {

@@ -245,6 +244,24 @@ return fromCodePoint(code);

function normalizeReference(str) {
// use .toUpperCase() instead of .toLowerCase()
// here to avoid a conflict with Object.prototype
// members (most notably, `__proto__`)
return str.trim().replace(/\s+/g, ' ').toUpperCase();
// Trim and collapse whitespace
//
str = str.trim().replace(/\s+/g, ' ');
// In node v10 'ẞ'.toLowerCase() === 'Ṿ', which is presumed to be a bug
// fixed in v12 (couldn't find any details).
//
// So treat this one as a special case
// (remove this when node v10 is no longer supported).
//
if ('ẞ'.toLowerCase() === 'Ṿ') {
str = str.replace(/ẞ/g, 'ß');
}
// .toLowerCase().toUpperCase() should get rid of all differences
// between letter variants.
//
// Final result should be uppercased, because it's later stored in an object
// (this avoid a conflict with Object.prototype members,
// most notably, `__proto__`)
//
return str.toLowerCase().toUpperCase();
}

@@ -251,0 +268,0 @@

@@ -6,3 +6,2 @@ // Parse link destination

var isSpace = require('../common/utils').isSpace;
var unescapeAll = require('../common/utils').unescapeAll;

@@ -26,3 +25,3 @@

code = str.charCodeAt(pos);
if (code === 0x0A /* \n */ || isSpace(code)) { return result; }
if (code === 0x0A /* \n */) { return result; }
if (code === 0x3E /* > */) {

@@ -29,0 +28,0 @@ result.pos = pos + 1;

@@ -34,3 +34,7 @@ // fences (``` lang, ~~~ lang)

if (params.indexOf(String.fromCharCode(marker)) >= 0) { return false; }
if (marker === 0x60 /* ` */) {
if (params.indexOf(String.fromCharCode(marker)) >= 0) {
return false;
}
}

@@ -37,0 +41,0 @@ // Since start is found, we can report success here in validation mode

@@ -117,5 +117,5 @@ // Lists

offset,
oldIndent,
oldLIndent,
oldListIndent,
oldParentType,
oldSCount,
oldTShift,

@@ -136,2 +136,14 @@ oldTight,

// Special case:
// - item 1
// - item 2
// - item 3
// - item 4
// - this one is a paragraph continuation
if (state.listIndent >= 0 &&
state.sCount[startLine] - state.listIndent >= 4 &&
state.sCount[startLine] < state.blkIndent) {
return false;
}
// limit conditions when list can interrupt

@@ -248,7 +260,15 @@ // a paragraph (validation mode only)

oldIndent = state.blkIndent;
// change current state, then restore it after parser subcall
oldTight = state.tight;
oldTShift = state.tShift[startLine];
oldLIndent = state.sCount[startLine];
oldSCount = state.sCount[startLine];
// - example list
// ^ listIndent position will be here
// ^ blkIndent position will be here
//
oldListIndent = state.listIndent;
state.listIndent = state.blkIndent;
state.blkIndent = indent;
state.tight = true;

@@ -279,5 +299,6 @@ state.tShift[startLine] = contentStart - state.bMarks[startLine];

state.blkIndent = oldIndent;
state.blkIndent = state.listIndent;
state.listIndent = oldListIndent;
state.tShift[startLine] = oldTShift;
state.sCount[startLine] = oldLIndent;
state.sCount[startLine] = oldSCount;
state.tight = oldTight;

@@ -299,2 +320,5 @@

// if it's indented more than 3 spaces, it should be a code block
if (state.sCount[startLine] - state.blkIndent >= 4) { break; }
// fail if terminating block found

@@ -301,0 +325,0 @@ terminate = false;

@@ -43,4 +43,4 @@ // Parser state class

// block parser variables
this.blkIndent = 0; // required block content indent
// (for example, if we are in list)
this.blkIndent = 0; // required block content indent (for example, if we are
// inside a list, it would be positioned after list marker)
this.line = 0; // line index in src

@@ -50,2 +50,3 @@ this.lineMax = 0; // lines count

this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any)
this.listIndent = -1; // indent of the current list block (-1 if there isn't any)

@@ -52,0 +53,0 @@ // can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'

@@ -10,3 +10,3 @@ // Normalize input string

module.exports = function inline(state) {
module.exports = function normalize(state) {
var str;

@@ -13,0 +13,0 @@

@@ -1,2 +0,2 @@

// Simple typographyc replacements
// Simple typographic replacements
//

@@ -65,12 +65,12 @@ // (c) (C) → ©

token.content = token.content
.replace(/\+-/g, '±')
// .., ..., ....... -> …
// but ?..... & !..... -> ?.. & !..
.replace(/\.{2,}/g, '…').replace(/([?!])…/g, '$1..')
.replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')
// em-dash
.replace(/(^|[^-])---([^-]|$)/mg, '$1\u2014$2')
// en-dash
.replace(/(^|\s)--(\s|$)/mg, '$1\u2013$2')
.replace(/(^|[^-\s])--([^-\s]|$)/mg, '$1\u2013$2');
.replace(/\+-/g, '±')
// .., ..., ....... -> …
// but ?..... & !..... -> ?.. & !..
.replace(/\.{2,}/g, '…').replace(/([?!])…/g, '$1..')
.replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')
// em-dash
.replace(/(^|[^-])---([^-]|$)/mg, '$1\u2014$2')
// en-dash
.replace(/(^|\s)--(\s|$)/mg, '$1\u2013$2')
.replace(/(^|[^-\s])--([^-\s]|$)/mg, '$1\u2013$2');
}

@@ -77,0 +77,0 @@ }

@@ -32,4 +32,4 @@ // Parse backticks

token.content = state.src.slice(pos, matchStart)
.replace(/[ \n]+/g, ' ')
.trim();
.replace(/\n/g, ' ')
.replace(/^ (.+) $/, '$1');
}

@@ -36,0 +36,0 @@ state.pos = matchEnd;

@@ -26,8 +26,19 @@ // For each opening emphasis-like marker find a matching closing one

var odd_match = false;
// typeofs are for backward compatibility with plugins
var odd_match = (currDelim.close || lastDelim.open) &&
typeof currDelim.length !== 'undefined' &&
typeof lastDelim.length !== 'undefined' &&
(currDelim.length + lastDelim.length) % 3 === 0;
if ((currDelim.close || lastDelim.open) &&
typeof currDelim.length !== 'undefined' &&
typeof lastDelim.length !== 'undefined') {
// 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 (!odd_match) {

@@ -34,0 +45,0 @@ lastDelim.jump = i - j;

@@ -11,3 +11,3 @@ // Process html entity - &#123;, &#xAF;, &quot;, ...

var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i;
var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
var NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;

@@ -14,0 +14,0 @@

{
"name": "markdown-it",
"version": "8.4.2",
"version": "9.0.0",
"description": "Markdown-it - modern pluggable markdown parser.",

@@ -19,4 +19,3 @@ "keywords": [

"scripts": {
"test": "make test",
"heroku-postbuild": "npm install express"
"test": "make test"
},

@@ -38,12 +37,11 @@ "files": [

"ansi": "^0.3.0",
"autoprefixer-stylus": "^0.11.0",
"autoprefixer-stylus": "^0.14.0",
"benchmark": "~2.1.0",
"browserify": "*",
"chai": "^3.4.1",
"coveralls": "~2.11.9",
"eslint": "^3.5.0",
"browserify": "^16.3.0",
"chai": "^4.2.0",
"coveralls": "^3.0.4",
"eslint": "^6.0.1",
"express": "^4.14.0",
"highlight.js": "^9.2.0",
"istanbul": "^0.4.5",
"jade": "~1.11.0",
"markdown-it-abbr": "^1.0.4",

@@ -54,3 +52,3 @@ "markdown-it-container": "^2.0.0",

"markdown-it-footnote": "^3.0.1",
"markdown-it-for-inline": "~0.1.0",
"markdown-it-for-inline": "^0.1.0",
"markdown-it-ins": "^2.0.0",

@@ -60,9 +58,10 @@ "markdown-it-mark": "^2.0.0",

"markdown-it-sup": "^1.0.0",
"markdown-it-testgen": "~0.1.3",
"mocha": "*",
"markdown-it-testgen": "^0.1.3",
"mocha": "^6.1.4",
"ndoc": "^5.0.0",
"stylus": "~0.54.2",
"supertest": "^3.0.0",
"uglify-js": "^3.0.18"
"pug-cli": "^1.0.0-alpha6",
"stylus": "^0.54.5",
"supertest": "^4.0.2",
"terser": "^4.1.2"
}
}

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