Socket
Socket
Sign inDemoInstall

marked

Package Overview
Dependencies
Maintainers
1
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marked - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

75

lib/marked.js

@@ -13,3 +13,3 @@ /**

var block = {
newline: /^\n/,
newline: /^\n+/,
block: /^ {4,}[^\n]*(?:\n {4,}[^\n]*)*/,

@@ -67,6 +67,6 @@ heading: /^ *(#{1,6}) *([^\n#]*) *#*/,

return block.token(str, tokens, 0);
return block.token(str, tokens);
};
block.token = function(str, tokens, line) {
block.token = function(str, tokens) {
var rules = block

@@ -92,8 +92,11 @@ , keys = block.keys

case 'newline':
line++;
if (cap[0].length > 1) {
tokens.push({
type: 'space'
});
}
break;
case 'hr':
tokens.push({
type: 'hr',
line: line
type: 'hr'
});

@@ -105,4 +108,3 @@ break;

depth: cap[2] === '=' ? 1 : 2,
text: cap[1],
line: line
text: cap[1]
});

@@ -114,4 +116,3 @@ break;

depth: cap[1].length,
text: cap[2],
line: line
text: cap[2]
});

@@ -123,4 +124,3 @@ break;

type: 'block',
text: cap,
line: line
text: cap
});

@@ -131,4 +131,3 @@ break;

type: 'list_start',
ordered: isFinite(cap[2]),
line: line
ordered: isFinite(cap[2])
});

@@ -152,14 +151,11 @@ // get each top-level

tokens.push({
type: 'list_item_start',
line: line
type: 'list_item_start'
});
block.token(item, tokens, line);
block.token(item, tokens);
tokens.push({
type: 'list_item_end',
line: line
type: 'list_item_end'
});
});
tokens.push({
type: 'list_end',
line: line
type: 'list_end'
});

@@ -171,4 +167,3 @@ break;

type: key,
text: cap[0],
line: line
text: cap[0]
});

@@ -178,10 +173,8 @@ break;

tokens.push({
type: 'blockquote_start',
line: line
type: 'blockquote_start'
});
cap = cap[0].replace(/^ *>/gm, '');
block.token(cap, tokens, line);
block.token(cap, tokens);
tokens.push({
type: 'blockquote_end',
line: line
type: 'blockquote_end'
});

@@ -201,3 +194,3 @@ break;

escape: /^\\([\\`*{}\[\]()#+\-.!])/,
autolink: /^<([^ >]+(:|@)[^ >]+)>/,
autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
tag: /^<[^\n>]+>/,

@@ -250,3 +243,3 @@ link: /^!?\[([^\]]+)\]\(([^\)]+)\)/,

, links = tokens.links
, link = {}
, link
, text

@@ -285,5 +278,9 @@ , href;

link = links[cap[2]];
if (!link) throw new
Error('Undefined Reference: ' + cap[2]);
} else {
link.href = cap[2];
link.title = cap[3];
link = {
href: cap[2],
title: cap[3]
};
}

@@ -304,6 +301,10 @@ out += '<a href="'

link = links[cap[2]];
if (!link) throw new
Error('Undefined Reference: ' + cap[2]);
} else {
text = /^([^\s]+)\s*(.+)?$/.exec(cap[2]);
link.href = text[1];
link.title = text[2];
link = {
href: text[1],
title: text[2]
};
}

@@ -374,2 +375,4 @@ out += '<img src="'

switch (token.type) {
case 'space':
return '';
case 'hr':

@@ -418,7 +421,5 @@ return '<hr>';

var body = [ token.text ]
, last = token.line
, top;
while ((top = tokens[tokens.length-1])
&& top.type === 'text'
&& top.line === ++last) {
&& top.type === 'text') {
body.push(next().text);

@@ -425,0 +426,0 @@ }

@@ -5,3 +5,3 @@ {

"author": "Christopher Jeffrey",
"version": "0.0.4",
"version": "0.0.5",
"main": "./lib/marked.js",

@@ -8,0 +8,0 @@ "bin": { "marked": "./bin/marked" },

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