Closed maxence-charriere closed 4 years ago
[ Quoting notifications@github.com in "[gomarkdown/markdown] Syntax Highli..." ]
Is it possible to have a highlighted code with this package? If yes, how to customize code highlighting from this generated code?
no, this is not possible, you need to add the css/js yourself that does this.
/Miek
-- Miek Gieben
Mmm I d like to but i dont see any tag/class in the generated code to style it.
[ Quoting notifications@github.com in "Re: [gomarkdown/markdown] Syntax Hi..." ]
Mmm I d like to but i dont see any tag/class in the generated code to style it.
ah, sorry, confused repos. Uhm then I'm not sure, maybe there is an option, but I would need to check the code.
/Miek
-- Miek Gieben
Ok so have to use a library like prism.js to highlight code. Thanks for the help :)
For future reference, here's how to do it with chroma library and using RenderNodeHook
for *ast.CodeBlock
node: https://github.com/gomarkdown/markdown/blob/master/examples/code_hightlight.go
Yes ! I figured that out by reading further on #164 thanks for the example
the link is dead @kjk ?
Yeah, sorry, I made the repo private. When I have time, I'll add an example to https://blog.kowalczyk.info/article/cxn3/advanced-markdown-processing-in-go.html
I've added an example of syntax highlighting: https://github.com/gomarkdown/markdown/blob/master/examples/code_hightlight.go (or https://onlinetool.io/goplayground/#Bk0zTvrzUDR)
Thank you!
Hello there,
I'm trying to convert markdown containing fenced golang code blocks.
The code generated look like this:
Is it possible to have a highlighted code with this package? If yes, how to customize code highlighting from this generated code?