correct text highlighting for no highlight

This commit is contained in:
Sam 2017-06-23 14:35:31 -04:00
parent a5295591b8
commit 814c8804d4
2 changed files with 3 additions and 1 deletions

View File

@ -21,7 +21,7 @@ function render(tokens, idx, options, env, slf, md) {
langName = info; 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 `<pre><code class='${className}'>${escapedContent}</code></pre>\n`; return `<pre><code class='${className}'>${escapedContent}</code></pre>\n`;
} }

View File

@ -587,6 +587,8 @@ HTML
it 'can include code class correctly' do it 'can include code class correctly' do
expect(PrettyText.cook("```cpp\ncpp\n```")).to match_html("<pre><code class='lang-cpp'>cpp\n</code></pre>") expect(PrettyText.cook("```cpp\ncpp\n```")).to match_html("<pre><code class='lang-cpp'>cpp\n</code></pre>")
expect(PrettyText.cook("```\ncpp\n```")).to match_html("<pre><code class='lang-auto'>cpp\n</code></pre>")
expect(PrettyText.cook("```text\ncpp\n```")).to match_html("<pre><code class='lang-nohighlight'>cpp\n</code></pre>")
end end
it 'indents code correctly' do it 'indents code correctly' do