Closed antoniomo closed 7 years ago
Also how does this look? I'm sort of weening myself from highlighting in my editor, so I want to keep this light as well - just bold keywords would be nice - more might be overkill
I see! It looks like this: http://prismjs.com/#examples and on the upper right part of the page you can change the theme. I picked up solarized as it's quite subtle and I thought good for a book, the default theme is a bit more colorful/maybe too much.
To test it with Go code/your book, do make
first to generate the html as usual, then make addhl
would add the syntax highlighting on those blocks that are properly marked as Go code. I can add the language hints on the other blocks these days if you like it, let me know :)
I'm sorry, but I find the default and 'solarized light' pretty unreadable. :-(
What I would like to add is to make the Go keywords bold, but that's it. Is that easily doable with prism? Or rip the stuff out of prism to make that possible?
I guess since prism already understand the Go keywords we just need to fiddle with the css
so that there's no coloring, only bold on those. Other than keywords, should we put bold for builtin types too (int et al)? I'll check this out tomorrow, now it's bed time here!
Hi! On a quick test this will be trivial to do. I'll polish the CSS a bit and do a new pull request once I'm done :)
[ Quoting notifications@github.com in "Re: [miekg/learninggo] Add code syn..." ]
Hi! On a quick test this will be trivial to do. I'll polish the CSS a bit and do a new pull request once I'm done :)
great! And thank you.
/Miek
-- Miek Gieben
This adds client-side syntax highlighting with http://prismjs.com
I'm aware that probably server-side syntax highlighting would be preferable, but this way we don't need to change anything in
mmark
or depend onpygmentize
or a similar tool being installed.TODO:
Fixes issue #2