diff --git a/app/assets/javascripts/pretty-text/engines/markdown-it/code.js.es6 b/app/assets/javascripts/pretty-text/engines/markdown-it/code.js.es6 index ca54a65ec03..c8d94967a1e 100644 --- a/app/assets/javascripts/pretty-text/engines/markdown-it/code.js.es6 +++ b/app/assets/javascripts/pretty-text/engines/markdown-it/code.js.es6 @@ -21,7 +21,7 @@ function render(tokens, idx, options, env, slf, md) { langName = info; } - className = TEXT_CODE_CLASSES.indexOf(langName) !== -1 ? 'lang-nohighlight' : 'lang-' + langName; + className = TEXT_CODE_CLASSES.indexOf(info) !== -1 ? 'lang-nohighlight' : 'lang-' + langName; return `
${escapedContent}
\n`;
}
diff --git a/spec/components/pretty_text_spec.rb b/spec/components/pretty_text_spec.rb
index 6cdae573e75..823da26f2e6 100644
--- a/spec/components/pretty_text_spec.rb
+++ b/spec/components/pretty_text_spec.rb
@@ -587,6 +587,8 @@ HTML
it 'can include code class correctly' do
expect(PrettyText.cook("```cpp\ncpp\n```")).to match_html("cpp\n
")
+ expect(PrettyText.cook("```\ncpp\n```")).to match_html("cpp\n
")
+ expect(PrettyText.cook("```text\ncpp\n```")).to match_html("cpp\n
")
end
it 'indents code correctly' do