mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 03:08:29 +08:00
FIX: Don't do intraword italics when prefixed by a forward slash
This commit is contained in:
parent
df5cbf76e0
commit
63f2187d72
|
@ -64,7 +64,7 @@ function invalidBoundary(args, prev) {
|
||||||
var last = prev[prev.length - 1];
|
var last = prev[prev.length - 1];
|
||||||
if (typeof last !== "string") { return; }
|
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; }
|
if (args.spaceBoundary && (!last.match(/\s$/))) { return true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ test("basic cooking", function() {
|
||||||
cooked("_trout_", "<p><em>trout</em></p>", "it italicizes text.");
|
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("***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("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 asterisks");
|
||||||
cooked("hello \\_evil\\_", "<p>hello _evil_</p>", "it supports escaping of italics");
|
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.");
|
cooked("brussel sproutes are *awful*.", "<p>brussel sproutes are <em>awful</em>.</p>", "it doesn't swallow periods.");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user