Comparing version 0.2.1 to 0.2.2
@@ -14,3 +14,3 @@ /** | ||
newline: /^\n+/, | ||
code: /^ {4,}[^\n]*(?:\n {4,}[^\n]*|\n)*(?:\n+|$)/, | ||
code: /^( {4}[^\n]+\n*)+/, | ||
fences: noop, | ||
@@ -21,3 +21,3 @@ hr: /^( *[\-*_]){3,} *(?:\n+|$)/, | ||
blockquote: /^( *>[^\n]+(\n[^\n]+)*\n*)+/, | ||
list: /^( *)([*+-]|\d+\.) [^\0]+?(?:\n{2,}(?! )|\s*$)(?!\1bullet)\n*/, | ||
list: /^( *)([*+-]|\d+\.) [^\0]+?(?:\n{2,}(?! )(?!\1bullet)\n*|\s*$)/, | ||
html: /^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/, | ||
@@ -29,23 +29,13 @@ def: /^ *\[([^\]]+)\]: *([^\s]+)(?: +["(]([^\n]+)[")])? *(?:\n+|$)/, | ||
block.list = (function() { | ||
var list = block.list.source; | ||
block.list = replace(block.list) | ||
('bullet', /(?:[*+-](?!(?: *[-*]){2,})|\d+\.)/) | ||
(); | ||
list = list | ||
.replace('bullet', /(?:[*+-](?!(?: *[-*]){2,})|\d+\.)/.source); | ||
block.html = replace(block.html) | ||
('comment', /<!--[^\0]*?-->/) | ||
('closed', /<(tag)[^\0]+?<\/\1>/) | ||
('closing', /<tag(?!:\/|@)\b(?:"[^"]*"|'[^']*'|[^'">])*?>/) | ||
(/tag/g, tag()) | ||
(); | ||
return new RegExp(list); | ||
})(); | ||
block.html = (function() { | ||
var html = block.html.source; | ||
html = html | ||
.replace('comment', /<!--[^\0]*?-->/.source) | ||
.replace('closed', /<(tag)[^\0]+?<\/\1>/.source) | ||
.replace('closing', /<tag(?!:\/|@)\b(?:"[^"]*"|'[^']*'|[^'">])*?>/.source) | ||
.replace(/tag/g, tag()); | ||
return new RegExp(html); | ||
})(); | ||
block.paragraph = (function() { | ||
@@ -81,12 +71,6 @@ var paragraph = block.paragraph.source | ||
block.gfm.paragraph = (function() { | ||
var paragraph = block.paragraph.source | ||
, fences = block.gfm.fences.source; | ||
block.gfm.paragraph = replace(block.paragraph) | ||
('(?!', '(?!' + block.gfm.fences.source.replace(/(^|[^\[])\^/g, '$1') + '|') | ||
(); | ||
fences = fences.replace(/(^|[^\[])\^/g, '$1'); | ||
paragraph = paragraph.replace(/(\(\?!)/, '$1' + fences + '|'); | ||
return new RegExp(paragraph); | ||
})(); | ||
/** | ||
@@ -217,3 +201,3 @@ * Block Lexer | ||
cap = cap[0].match( | ||
/^( *)([*+-]|\d+\.)[^\n]*(?:\n(?!\1(?:[*+-]|\d+\.))[^\n]*)*/gm | ||
/^( *)([*+-]|\d+\.) [^\n]*(?:\n(?!\1(?:[*+-]|\d+\.) )[^\n]*)*/gm | ||
); | ||
@@ -231,3 +215,3 @@ | ||
space = item.length; | ||
item = item.replace(/^ *([*+-]|\d+\.) */, ''); | ||
item = item.replace(/^ *([*+-]|\d+\.) +/, ''); | ||
@@ -328,4 +312,4 @@ // Outdent whatever the | ||
tag: /^<!--[^\0]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/, | ||
link: /^!?\[((?:\[[^\]]*\]|[^\[\]]|\[|\](?=[^[\]]*\]))*)\]\(([^\)]*)\)/, | ||
reflink: /^!?\[((?:\[[^\]]*\]|[^\[\]]|\[|\](?=[^[\]]*\]))*)\]\s*\[([^\]]*)\]/, | ||
link: /^!?\[(inside)\]\(href\)/, | ||
reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/, | ||
nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/, | ||
@@ -339,2 +323,14 @@ strong: /^__([^\0]+?)__(?!_)|^\*\*([^\0]+?)\*\*(?!\*)/, | ||
inline._linkInside = /(?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*/; | ||
inline._linkHref = /\s*<?([^\s]*?)>?(?:\s+"([^\n]+)")?\s*/; | ||
inline.link = replace(inline.link) | ||
('inside', inline._linkInside) | ||
('href', inline._linkHref) | ||
(); | ||
inline.reflink = replace(inline.reflink) | ||
('inside', inline._linkInside) | ||
(); | ||
inline.normal = { | ||
@@ -353,12 +349,6 @@ url: inline.url, | ||
inline.gfm = { | ||
url: /^(\w+:\/\/[^\s]+[^.,:;"')\]\s])/, | ||
// br: /^\n(?!\s*$)/, | ||
text: /^[^\0]+?(?=[\\<!\[_*`]|\w+:\/\/| {2,}\n|$)/ | ||
url: /^(https?:\/\/[^\s]+[^.,:;"')\]\s])/, | ||
text: /^[^\0]+?(?=[\\<!\[_*`]|https?:\/\/| {2,}\n|$)/ | ||
}; | ||
inline.discount = { | ||
strong: /^__([^\0]+?)__(?!_)|^\*\*([^\0]+?)\*\*(?!\*)/, | ||
em: /^\b_(?=\S)([^\0]*?\S)_\b|^\*(?=\S)([^\0]*?(?:\*\*|[^\s*]))\*(?!\*)/ | ||
}; | ||
/** | ||
@@ -429,11 +419,5 @@ * Inline Lexer | ||
src = src.substring(cap[0].length); | ||
text = /^\s*<?([^\s]*?)>?(?:\s+"([^\n]+)")?\s*$/.exec(cap[2]); | ||
if (!text) { | ||
out += cap[0][0]; | ||
src = cap[0].substring(1) + src; | ||
continue; | ||
} | ||
out += outputLink(cap, { | ||
href: text[1], | ||
title: text[2] | ||
href: cap[2], | ||
title: cap[3] | ||
}); | ||
@@ -709,2 +693,11 @@ continue; | ||
function replace(regex) { | ||
regex = regex.source; | ||
return function self(name, val) { | ||
if (!name) return new RegExp(regex); | ||
regex = regex.replace(name, val.source || val); | ||
return self; | ||
}; | ||
} | ||
function noop() {} | ||
@@ -711,0 +704,0 @@ noop.exec = noop; |
@@ -5,3 +5,3 @@ { | ||
"author": "Christopher Jeffrey", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"main": "./lib/marked.js", | ||
@@ -8,0 +8,0 @@ "bin": "./bin/marked", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24301
659