FIX: You couldn't span multiple lines with bold or italics

This commit is contained in:
Robin Ward 2014-07-25 16:07:42 -04:00
parent b2f2e7b1d2
commit 423d37a2b6
2 changed files with 5 additions and 1 deletions

View File

@ -23,7 +23,7 @@ var replaceMarkdown = function(match, tag) {
} }
var endText = new RegExp("[^\\s|" + match[0] + "]" + match.replace(/\*/g,"\\*") + "([^" + match[0] + "]|$)"); var endText = new RegExp("[^\\s|" + match[0] + "]" + match.replace(/\*/g,"\\*") + "([^" + match[0] + "]|$)");
var finish = text.split("\n")[0].search(endText); var finish = text.search(endText);
if(finish && finish >= 0) { if(finish && finish >= 0) {
var newText = text.substring(match.length,finish+1); var newText = text.substring(match.length,finish+1);
newText = this.processInline(newText); newText = this.processInline(newText);

View File

@ -276,6 +276,10 @@ test("bold and italics", function() {
cooked("**你hello**", "<p><strong>你hello</strong></p>", "allows bolded chinese"); cooked("**你hello**", "<p><strong>你hello</strong></p>", "allows bolded chinese");
}); });
test("New Lines", function() {
cooked("_abc\ndef_", "<p><em>abc<br>def</em></p>", "it allows markup to span new lines");
});
test("Oneboxing", function() { test("Oneboxing", function() {
var matches = function(input, regexp) { var matches = function(input, regexp) {