Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 3.0.4 to 3.0.5

9

CHANGELOG.md

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

3.0.5 / 2015-02-06
------------------
- 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

@@ -2,0 +11,0 @@ ------------------

8

lib/helpers/parse_link_label.js

@@ -14,7 +14,2 @@ // Parse link label

if (state.labelUnmatchedScopes) {
state.labelUnmatchedScopes--;
return -1;
}
state.pos = start + 1;

@@ -48,5 +43,2 @@ level = 1;

labelEnd = state.pos;
state.labelUnmatchedScopes = 0;
} else {
state.labelUnmatchedScopes = level - 1;
}

@@ -53,0 +45,0 @@

6

lib/parser_inline.js

@@ -33,7 +33,7 @@ /** internal

function validateLink(url) {
var str = url.trim().toLowerCase();
// Care about digital entities "javascript:alert(1)"
str = replaceEntities(str);
var str = replaceEntities(url);
str = str.trim().toLowerCase();
if (str.indexOf(':') >= 0 && BAD_PROTOCOLS.indexOf(str.split(':')[0]) >= 0) {

@@ -40,0 +40,0 @@ return false;

@@ -13,4 +13,2 @@ // Block quotes

if (pos > max) { return false; }
// check the block quote marker

@@ -17,0 +15,0 @@ if (state.src.charCodeAt(pos++) !== 0x3E/* > */) { return false; }

@@ -11,4 +11,2 @@ // heading (#, ##, ...)

if (pos >= max) { return false; }
ch = state.src.charCodeAt(pos);

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

@@ -8,9 +8,5 @@ // Horizontal rule

var marker, cnt, ch,
pos = state.bMarks[startLine],
pos = state.bMarks[startLine] + state.tShift[startLine],
max = state.eMarks[startLine];
pos += state.tShift[startLine];
if (pos > max) { return false; }
marker = state.src.charCodeAt(pos++);

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

@@ -14,4 +14,2 @@ // Lists

if (pos >= max) { return -1; }
marker = state.src.charCodeAt(pos++);

@@ -40,2 +38,3 @@ // Check bullet

// List marker should have at least 2 chars (digit + dot)
if (pos + 1 >= max) { return -1; }

@@ -170,6 +169,2 @@

// If indent is less than 1, assume that it's one, example:
// "-\n test"
if (indentAfterMarker < 1) { indentAfterMarker = 1; }
// " - test"

@@ -176,0 +171,0 @@ // ^^^^^ - calculating total length of this thing

@@ -37,24 +37,22 @@ // Paragraph

state.line = nextLine;
if (content.length) {
state.tokens.push({
type: 'paragraph_open',
tight: false,
lines: [ startLine, state.line ],
level: state.level
});
state.tokens.push({
type: 'inline',
content: content,
level: state.level + 1,
lines: [ startLine, state.line ],
children: []
});
state.tokens.push({
type: 'paragraph_close',
tight: false,
level: state.level
});
}
state.tokens.push({
type: 'paragraph_open',
tight: false,
lines: [ startLine, state.line ],
level: state.level
});
state.tokens.push({
type: 'inline',
content: content,
level: state.level + 1,
lines: [ startLine, state.line ],
children: []
});
state.tokens.push({
type: 'paragraph_close',
tight: false,
level: state.level
});
return true;
};

@@ -30,3 +30,2 @@ 'use strict';

if (pos >= max) { return false; }
if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false; }

@@ -38,3 +37,3 @@

if (nextLine < endLine && !state.isEmpty(nextLine)) {
terminatorRules = state.md.block.ruler.getRules('references');
terminatorRules = state.md.block.ruler.getRules('reference');

@@ -41,0 +40,0 @@ for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {

@@ -37,3 +37,3 @@ // GFM table, non-standard

rows = lineText.split('|');
if (rows <= 2) { return false; }
if (rows.length < 2) { return false; }
aligns = [];

@@ -40,0 +40,0 @@ for (i = 0; i < rows.length; i++) {

@@ -20,7 +20,2 @@ // Inline parser state

// optimization of pairs parse (emphasis, strikes).
// Link parser state vars
this.labelUnmatchedScopes = 0; // Track unpaired `[` for link labels
// (backtrack optimization)
}

@@ -27,0 +22,0 @@

{
"name": "markdown-it",
"version": "3.0.4",
"version": "3.0.5",
"description": "Markdown-it - modern pluggable markdown parser.",

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

"chai": "~1.10.0",
"commonmark": "~ 0.15.0",
"commonmark": "~ 0.16.0",
"coveralls": "~2.11.2",

@@ -38,0 +38,0 @@ "eslint": "0.11.0",

@@ -215,6 +215,6 @@ # markdown-it

Sample: spec.txt (110610 bytes)
> commonmark-reference x 40.42 ops/sec ±4.07% (51 runs sampled)
> current x 74.99 ops/sec ±4.69% (67 runs sampled)
> current-commonmark x 93.76 ops/sec ±1.23% (79 runs sampled)
> marked-0.3.2 x 22.92 ops/sec ±0.79% (41 runs sampled)
> commonmark-reference x 60.70 ops/sec ±7.76% (61 runs sampled)
> current x 80.00 ops/sec ±2.03% (68 runs sampled)
> current-commonmark x 103 ops/sec ±0.72% (76 runs sampled)
> marked-0.3.2 x 22.65 ops/sec ±3.07% (41 runs sampled)
```

@@ -221,0 +221,0 @@

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