add potential strong/em behavior, dont check cap[1] in code rule

This commit is contained in:
Christopher Jeffrey 2012-01-14 21:08:48 -06:00
parent 91bb13c714
commit 3175953d0c

View File

@ -306,10 +306,15 @@ var inline = {
strong: /^__([^\0]+?)__(?!_)|^\*\*([^\0]+?)\*\*(?!\*)/, strong: /^__([^\0]+?)__(?!_)|^\*\*([^\0]+?)\*\*(?!\*)/,
em: /^\b_([^\0]+?)_\b|^\*((?:\*\*|[^\0])+?)\*(?!\*)/, em: /^\b_([^\0]+?)_\b|^\*((?:\*\*|[^\0])+?)\*(?!\*)/,
// markdown.pl em/strong behavior // upskirt/markdown.pl em/strong behavior
// strong: /^__(?=\S)([^\0]*?\S)__(?!_)|^\*\*(?=\S)([^\0]*?\S)\*\*(?!\*)/, // strong: /^__(?=\S)([^\0]*?\S)__(?!_)|^\*\*(?=\S)([^\0]*?\S)\*\*(?!\*)/,
// em: /^\b_(?=\S)([^\0]*?\S)_\b|^\*(?=\S)([^\0]*?\S)\*(?!\*)/, // em: /^\b_(?=\S)([^\0]*?\S)_\b|^\*(?=\S)([^\0]*?\S)\*(?!\*)/,
// strict em/strong behavior
// closest to being conformant without markdown.pl's bugs
// strong: /^__(?=\S)([^\0]*?\S)__(?!_)|^\*\*(?=\S)([^\0]*?\S)\*\*(?!\*)/,
// em: /^\b_(?=\S)([^\0]*?\S)_\b|^\*(?=\S)([^\0]*?(?:\*\*|[^\s*]))\*(?!\*)/,
code: /^(`+)([^\0]*?[^`])\1(?!`)/, code: /^(`+)([^\0]*?[^`])\1(?!`)/,
br: /^ {2,}\n(?!\s*$)/, br: /^ {2,}\n(?!\s*$)/,
text: /^[^\0]+?(?=body|$)/ text: /^[^\0]+?(?=body|$)/
@ -451,7 +456,7 @@ inline.lexer = function(str) {
if (cap = inline.code.exec(str)) { if (cap = inline.code.exec(str)) {
str = str.substring(cap[0].length); str = str.substring(cap[0].length);
out += '<code>' out += '<code>'
+ escape(cap[2] || cap[1], true) + escape(cap[2], true)
+ '</code>'; + '</code>';
continue; continue;
} }