A couple of important markdown fixes.

This commit is contained in:
Robin Ward 2013-08-28 11:14:06 -04:00
parent f611a5d898
commit f7ad80ff7b
3 changed files with 4 additions and 1 deletions

View File

@ -20,6 +20,7 @@ var replaceMarkdown = function(match, tag) {
};
replaceMarkdown('**', 'strong');
replaceMarkdown('__', 'strong');
replaceMarkdown('*', 'em');
replaceMarkdown('_', 'em');

View File

@ -163,7 +163,7 @@ Discourse.Dialect = {
var contents = args.emitter.call(this, between);
if (contents) {
return [endPos + startLength + 1, contents];
return [endPos+stop.length, contents];
}
};

View File

@ -18,12 +18,14 @@ var cookedOptions = function(input, opts, expected, text) {
test("basic cooking", function() {
cooked("hello", "<p>hello</p>", "surrounds text with paragraphs");
cooked("**evil**", "<p><strong>evil</strong></p>", "it bolds text.");
cooked("__bold__", "<p><strong>bold</strong></p>", "it bolds text.");
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("word_with_underscores", "<p>word_with_underscores</p>", "it doesn't do intraword italics");
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.");
});
test("Traditional Line Breaks", function() {