Skip to content

Commit

Permalink
FIX: Markdown bug
Browse files Browse the repository at this point in the history
  • Loading branch information
eviltrout committed Nov 19, 2013
1 parent 981d8f6 commit 4a32cdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions test/javascripts/lib/markdown_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ test("Traditional Line Breaks", function() {
cooked(input, traditionalOutput, "It supports traditional markdown via a Site Setting");
});

test("Unbalanced underscores", function() {
cooked("[evil_trout][1] hello_\n\n[1]: http://eviltrout.com", "<p><a href=\"http://eviltrout.com\">evil_trout</a> hello_</p>");
});

test("Line Breaks", function() {
cooked("[] first choice\n[] second choice",
"<p>[] first choice<br/>[] second choice</p>",
Expand Down
5 changes: 3 additions & 2 deletions vendor/assets/javascripts/better_markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,8 @@
var DialectHelpers = {};
DialectHelpers.inline_until_char = function( text, want ) {
var consumed = 0,
nodes = [];
nodes = [],
patterns = this.dialect.inline.__patterns__.replace('|_|', '');

while ( true ) {
if ( text.charAt( consumed ) === want ) {
Expand All @@ -657,7 +658,7 @@
return null;
}

var res = this.dialect.inline.__oneElement__.call(this, text.substr( consumed ) );
var res = this.dialect.inline.__oneElement__.call(this, text.substr( consumed ), patterns );
consumed += res[ 0 ];
// Add any returned nodes.
nodes.push.apply( nodes, res.slice( 1 ) );
Expand Down

0 comments on commit 4a32cdd

Please sign in to comment.