hack.chat icon indicating copy to clipboard operation
hack.chat copied to clipboard

Feature req: Code syntax highlighting?

Open peterkos opened this issue 8 years ago • 7 comments

The whitespace is already preserved, so another enhancement to the viewing of code might be cool.

peterkos avatar Aug 12 '15 03:08 peterkos

You mean like a <code ... /> feature where you could hide code snippets ?

ToastyStoemp avatar Aug 12 '15 11:08 ToastyStoemp

Perhaps ``` can be used to surround code in the textbox to trigger this behavior.

AndrewBelt avatar Aug 12 '15 11:08 AndrewBelt

I know its python, but might be considered as a reference: http://pygments.org/faq/ and http://ralphminderhoud.com/posts/pelican-theme-syntax-highlighting/

andrewgdunn avatar Sep 25 '15 00:09 andrewgdunn

Its not really syntax highlighting, but it is on my to do list; image

this is done with the plugin for hack.chat: https://github.com/ToastyStoemp/Hack.Chat-Enhancement-kit

ToastyStoemp avatar Sep 25 '15 18:09 ToastyStoemp

Indenting the code with 4 spaces should also work to comply with markdown standard and the websites using it.

gkbrk avatar Sep 25 '15 18:09 gkbrk

I like the design of @ToastyStoemp's code block. Should ``` or four-spaces (or both) be used for syntax highlighting?

Edit: I like the triple-tilde syntax since I can modify the behavior of the Enter key to insert a newline instead of submitting the message inside a ``` block. Also it's easier to paste code that doesn't already have indentation. And I don't really care about the Markdown standard.

AndrewBelt avatar Sep 25 '15 19:09 AndrewBelt

The plugin uses

//code

at the moment, longer code snippets, longer then 15 lines, are included with a scroll bar: image

ToastyStoemp avatar Sep 25 '15 19:09 ToastyStoemp