FIX: Don't do intraword italics when prefixed by a forward slash

This commit is contained in:
Robin Ward 2013-08-30 10:56:41 -04:00
parent df5cbf76e0
commit 63f2187d72
2 changed files with 2 additions and 1 deletions

View File

@ -64,7 +64,7 @@ function invalidBoundary(args, prev) {
var last = prev[prev.length - 1];
if (typeof last !== "string") { return; }
if (args.wordBoundary && (!last.match(/\W$/))) { return true; }
if (args.wordBoundary && (last.match(/(\w|\/)$/))) { return true; }
if (args.spaceBoundary && (!last.match(/\s$/))) { return true; }
}

View File

@ -23,6 +23,7 @@ test("basic cooking", function() {
cooked("_trout_", "<p><em>trout</em></p>", "it italicizes text.");
cooked("***hello***", "<p><strong><em>hello</em></strong></p>", "it can do bold and italics at once.");
cooked("word_with_underscores", "<p>word_with_underscores</p>", "it doesn't do intraword italics");
cooked("common/_special_font_face.html.erb", "<p>common/_special_font_face.html.erb</p>", "it doesn't intraword with a slash");
cooked("hello \\*evil\\*", "<p>hello *evil*</p>", "it supports escaping of asterisks");
cooked("hello \\_evil\\_", "<p>hello _evil_</p>", "it supports escaping of italics");
cooked("brussel sproutes are *awful*.", "<p>brussel sproutes are <em>awful</em>.</p>", "it doesn't swallow periods.");