Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
markdown: Disable Codehilite language guessing
It appears that for random text the MIME lexer wins: In [4]: import pygments.lexer In [5]: pygments.lexers.guess_lexer("Hallo") Out[5]: <pygments.lexers.MIMELexer> which usually generates errors for random text: In [11]: from markdown.extensions.codehilite import CodeHilite In [12]: CodeHilite(src = 'Hallo').hilite() Out[12]: '<div class="codehilite"><pre><span></span><span class="err">Hallo</span>\n</pre></div>\n' which just look ugly (red border on each line). So switch off language guessing. In that case, code blocks without a explicit language are left as is: In [13]: CodeHilite(src = 'Hallo',guess_lang=False).hilite() Out[13]: '<div class="codehilite"><pre><span></span>Hallo\n</pre></div>\n' In Markdown, the language should be set explicitly, for language specific highlighting. :::python print("Hallo")
- Loading branch information