correct text highlighting for no highlight
This commit is contained in:
parent
a5295591b8
commit
814c8804d4
|
@ -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`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue