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.1.0 to 0.1.1

161

lib/marked.js

@@ -20,3 +20,3 @@ /**

list: /^( *)([*+-]|\d+\.) [^\0]+?(?:\n{2,}(?! )|\s*$)(?!\1\2|\1\d+\.)/,
html: /^ *(?:<!--[^\0]*?-->|<(\w+)[^\0]+?<\/\1>|<[^<>\n]+>) *(?:\n{2,}|\s*$)/,
html: /^ *(?:<!--[^\0]*?-->|<(\w+)[^\0]+?<\/\1>|<\w+[^>]*>) *(?:\n{2,}|\s*$)/,
text: /^[^\n]+/

@@ -26,10 +26,10 @@ };

block.keys = [
'newline',
'block',
'heading',
'lheading',
'hr',
'blockquote',
'list',
'html',
'newline',
'block',
'heading',
'lheading',
'hr',
'blockquote',
'list',
'html',
'text'

@@ -46,10 +46,7 @@ ];

// normalize whitespace
str = str.replace(/\r\n/g, '\n')
.replace(/\r/g, '\n')
str = str.replace(/\r\n|\r/g, '\n')
.replace(/\t/g, ' ');
// grab link definitons
str = str.replace(
/^ {0,3}\[([^\]]+)\]: *([^ ]+)(?: +"([^\n]+)")? *$/gm,
/^ {0,3}\[([^\]]+)\]: *([^ ]+)(?: +"([^\n]+)")? *$/gm,
function(__, id, href, title) {

@@ -106,4 +103,4 @@ links[id] = {

tokens.push({
type: 'heading',
depth: cap[2] === '=' ? 1 : 2,
type: 'heading',
depth: cap[2] === '=' ? 1 : 2,
text: cap[1]

@@ -114,4 +111,4 @@ });

tokens.push({
type: 'heading',
depth: cap[1].length,
type: 'heading',
depth: cap[1].length,
text: cap[2]

@@ -123,3 +120,3 @@ });

tokens.push({
type: 'block',
type: 'block',
text: cap

@@ -139,6 +136,6 @@ });

each(cap, function(item) {
// remove the list items sigil
// remove the list items sigil
// so its seen as the next token
item = item.replace(/^ *([*+-]|\d+\.) */, '');
// outdent whatever the
// outdent whatever the
// list item contains, hacky

@@ -151,3 +148,3 @@ var space = /\n( +)/.exec(item);

tokens.push({
type: loose
type: loose
? 'loose_item_start'

@@ -168,3 +165,3 @@ : 'list_item_start'

tokens.push({
type: key,
type: key,
text: cap[0]

@@ -196,3 +193,3 @@ });

autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
tag: /^<!--[^\0]*?-->|^<[^\n>]+>/,
tag: /^<!--[^\0]*?-->|^<\/?\w+[^>]*>/,
link: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]\s*\(([^\)]*)\)/,

@@ -210,9 +207,9 @@ reflink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]\s*\[([^\]]*)\]/,

'escape',
'autolink',
'tag',
'link',
'reflink',
'autolink',
'tag',
'link',
'reflink',
'nolink',
'strong',
'em',
'strong',
'em',
'code',

@@ -240,3 +237,3 @@ 'br',

return new
return new
RegExp('^[^\\0]+?(?=' + body.join('|') + '|$)');

@@ -275,3 +272,3 @@ })();

switch (key) {
case 'escape':
case 'escape':
out += cap[1];

@@ -301,10 +298,10 @@ break;

if (cap[0][0] !== '!') {
out += '<a href="'
+ escape(link.href)
+ '"'
out += '<a href="'
+ escape(link.href)
+ '"'
+ (link.title
? ' title="'
? ' title="'
+ escape(link.title)
+ '"'
: '')
+ '"'
: '')
+ '>'

@@ -314,12 +311,12 @@ + inline.lexer(cap[1])

} else {
out += '<img src="'
out += '<img src="'
+ escape(link.href)
+ '" alt="'
+ '" alt="'
+ escape(cap[1])
+ '"'
+ '"'
+ (link.title
? ' title="'
? ' title="'
+ escape(link.title)
+ '"'
: '')
+ '"'
: '')
+ '>';

@@ -343,14 +340,14 @@ }

case 'strong':
out += '<strong>'
+ inline.lexer(cap[2] || cap[1])
out += '<strong>'
+ inline.lexer(cap[2] || cap[1])
+ '</strong>';
break;
case 'em':
out += '<em>'
+ inline.lexer(cap[2] || cap[1])
out += '<em>'
+ inline.lexer(cap[2] || cap[1])
+ '</em>';
break;
case 'code':
out += '<code>'
+ escape(cap[2] || cap[1])
out += '<code>'
+ escape(cap[2] || cap[1])
+ '</code>';

@@ -364,4 +361,2 @@ break;

break;
default:
break;
}

@@ -388,13 +383,13 @@ }

return '';
case 'hr':
case 'hr':
return '<hr>';
case 'heading':
return '<h' + token.depth + '>'
case 'heading':
return '<h' + token.depth + '>'
+ inline.lexer(token.text)
+ '</h' + token.depth + '>';
case 'block':
return '<pre><code>'
case 'block':
return '<pre><code>'
+ escape(token.text)
+ '</code></pre>';
case 'blockquote_start':
case 'blockquote_start':
var body = [];

@@ -404,25 +399,25 @@ while (next().type !== 'blockquote_end') {

}
return '<blockquote>'
+ body.join('')
return '<blockquote>'
+ body.join('')
+ '</blockquote>';
case 'list_start':
var body = []
, type = token.ordered ? 'ol' : 'ul';
var type = token.ordered ? 'ol' : 'ul'
, body = [];
while (next().type !== 'list_end') {
body.push(tok());
}
return '<' + type + '>'
+ body.join('')
return '<' + type + '>'
+ body.join('')
+ '</' + type + '>';
case 'list_item_start':
case 'list_item_start':
var body = [];
while (next().type !== 'list_item_end') {
body.push(token.type === 'text'
? inline.lexer(token.text)
? text()
: tok());
}
return '<li>'
+ body.join(' ')
return '<li>'
+ body.join(' ')
+ '</li>';
case 'loose_item_start':
case 'loose_item_start':
var body = [];

@@ -432,18 +427,22 @@ while (next().type !== 'list_item_end') {

}
return '<li>'
+ body.join(' ')
return '<li>'
+ body.join(' ')
+ '</li>';
case 'html':
return inline.lexer(token.text);
case 'text':
var body = [ token.text ]
, top;
while ((top = tokens[tokens.length-1])
&& top.type === 'text') {
body.push(next().text);
}
return '<p>'
+ inline.lexer(body.join('\n'))
+ '</p>';
case 'text':
return '<p>' + text() + '</p>';
}
};
var text = function() {
var body = [ token.text ]
, top;
while ((top = tokens[tokens.length-1])
&& top.type === 'text') {
body.push(next().text);
}
return inline.lexer(body.join('\n'));
};

@@ -450,0 +449,0 @@

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

"author": "Christopher Jeffrey",
"version": "0.1.0",
"version": "0.1.1",
"main": "./lib/marked.js",

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

Sorry, the diff of this file is not supported yet

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