From 36f53790f47b976a68ff053834ec5655f47f3cb4 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 31 Dec 2014 11:44:56 -0500 Subject: [PATCH] Added test for markdown bug with linking `[ul]` and `[poll]` --- test/javascripts/lib/markdown-test.js.es6 | 4 ++++ vendor/assets/javascripts/better_markdown.js | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test/javascripts/lib/markdown-test.js.es6 b/test/javascripts/lib/markdown-test.js.es6 index 72203067e38..7c6cf4e4080 100644 --- a/test/javascripts/lib/markdown-test.js.es6 +++ b/test/javascripts/lib/markdown-test.js.es6 @@ -150,6 +150,10 @@ test("Links", function() { cooked("[Link](http://www.example.com) (with an outer \"description\")", "

Link (with an outer \"description\")

", "it doesn't consume closing parens as part of the url"); + + cooked("[ul][1]\n\n[1]: http://eviltrout.com", + "

ul

", + "it can use `ul` as a link name"); }); test("simple quotes", function() { diff --git a/vendor/assets/javascripts/better_markdown.js b/vendor/assets/javascripts/better_markdown.js index f8494d9e83e..f01451ec283 100644 --- a/vendor/assets/javascripts/better_markdown.js +++ b/vendor/assets/javascripts/better_markdown.js @@ -1186,15 +1186,14 @@ this, text.substr( m.index ), m, previous_nodes || [] ); - if(!res){ - // fallback + // If no inline code executed, fallback + if (!res) { var fn = this.dialect.inline[m[1][0]]; - if(fn) { + if (fn) { res = fn.call( this, text.substr( m.index ), m, previous_nodes || [] ); } - } } // Default for now to make dev easier. just slurp special and output it.