From 0bab3f9b4e9a5f05eecba7d8d5e3069d7979480a Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 20 Nov 2013 11:53:06 -0500 Subject: [PATCH] Revert "Revert "FIX: Markdown bug", breaks build" This reverts commit 08ad5d479e99f3dce28f69e8e73ccb01853db4d3. --- test/javascripts/lib/markdown_test.js | 4 ++++ vendor/assets/javascripts/better_markdown.js | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/test/javascripts/lib/markdown_test.js b/test/javascripts/lib/markdown_test.js index c5cdc6108..d3c3ba1b7 100644 --- a/test/javascripts/lib/markdown_test.js +++ b/test/javascripts/lib/markdown_test.js @@ -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", "

evil_trout hello_

"); +}); + test("Line Breaks", function() { cooked("[] first choice\n[] second choice", "

[] first choice
[] second choice

", diff --git a/vendor/assets/javascripts/better_markdown.js b/vendor/assets/javascripts/better_markdown.js index 93555f4c5..304606cdd 100644 --- a/vendor/assets/javascripts/better_markdown.js +++ b/vendor/assets/javascripts/better_markdown.js @@ -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 ) { @@ -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 ) );