diff --git a/app/assets/javascripts/pretty-text/engines/discourse-markdown/helpers.js.es6 b/app/assets/javascripts/pretty-text/engines/discourse-markdown/helpers.js.es6 index 9778f5b5f2e..cd246286896 100644 --- a/app/assets/javascripts/pretty-text/engines/discourse-markdown/helpers.js.es6 +++ b/app/assets/javascripts/pretty-text/engines/discourse-markdown/helpers.js.es6 @@ -38,8 +38,12 @@ export function textReplace(state, callback, skipAllLinks) { if (token.type === "link_open" || token.type === "link_close") { linkLevel -= token.nesting; } else if (token.type === "html_inline") { - if (token.content.substr(0, 2).toLowerCase() === "/i)) { + linkLevel++; + } } else if (token.content.substr(0, 4).toLowerCase() === "") { linkLevel--; } diff --git a/spec/components/pretty_text_spec.rb b/spec/components/pretty_text_spec.rb index e1a51ec510c..10fddf0e503 100644 --- a/spec/components/pretty_text_spec.rb +++ b/spec/components/pretty_text_spec.rb @@ -204,6 +204,10 @@ describe PrettyText do describe "Mentions" do + it "can handle mentions after abbr" do + expect(PrettyText.cook("test test\n\n@bob")).to eq("

test test

\n

@bob

") + end + it "should handle 3 mentions in a row" do expect(PrettyText.cook('@hello @hello @hello')).to match_html "

@hello @hello @hello

" end