You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get it now. Sorry for OT. @hroncok's idea is probably the best.
It will be mostly copy&paste when created.
A question is if it will be easy enough to edit such source.
fromansi2htmlimportAnsi2HTMLConverteransi_convertor=Ansi2HTMLConverter(inline=True)
...
iflang=='ansi':
converted=ansi_convertor.convert(code, full=False) # already escapes HTML (do we need to use some Markup() equivalent in mistune?)return'<div class="codehilite"><pre><code>{}</code></pre></div>'.format(converted)
Activity
hroncok commentedon Mar 16, 2017
Keep the color escape codes and write a plugin for the Markdown parser that converts them to HTML style/class?
benabraham commentedon Mar 16, 2017
I use https://highlightjs.org/ on client. Many syntaxes, many color themes.
hroncok commentedon Mar 16, 2017
Here we use Pygments.
encukou commentedon Mar 16, 2017
Pygments also has many syntaxes and color schemes for syntax highliting. This is not about syntax highlighting, though.
Als, no JS please. All this could end up printed in a book.
benabraham commentedon Mar 16, 2017
I get it now. Sorry for OT. @hroncok's idea is probably the best.
It will be mostly copy&paste when created.
A question is if it will be easy enough to edit such source.
Sanqui commentedon Mar 16, 2017
I believe ansi2html can be used for this.
hroncok commentedon Mar 16, 2017
naucse.python.cz/naucse/markdown_util.py
Line 63 in e2c0ea9
Seems easy!
Support ANSI colors code blocks
Support ANSI colors code blocks
Support ANSI colors code blocks
Support ANSI colors code blocks
Support ANSI colors code blocks
encukou commentedon Mar 20, 2017
Reopening this – it still should be possible to do it in a more elegant way.
Use ANSI color codes for a diff
hroncok commentedon Mar 21, 2017
GitHub umí tohle:
Nevyřešilo by to všechny případy, ale pro diffy/commity by to vypadalo dobře i na githubu i na webu, kdybychom měli pro pygments takový lexer.
Use ANSI color codes for a diff
encukou commentedon Mar 21, 2017
Mám za to že v Pygments se jen jinak jmenuje –
diffhroncok commentedon Mar 21, 2017
Když jsme to použil, vypadalo to jako plaintext. Možná něco dělám špatně.
Use ANSI color codes for a diff
Use `diff` syntax highlighter instead of ANSI color codes
Use `diff` syntax highlighter instead of ANSI color codes
encukou commentedon Apr 6, 2019
Still not ideal, but I don't think it makes sense to track this here – there'll always be something more inportant.
Merge pull request pyvec#61 from pyvec/master