erusev / parsedown

Better Markdown Parser in PHP
https://parsedown.org
MIT License
14.76k stars 1.12k forks source link

Syntax highlighting support? #864

Open utkumaden opened 8 months ago

utkumaden commented 8 months ago

Although the text processor seems to attach a language-xxx class to markdown code blocks, it seems there is no support for rendering code blocks with syntax highlighting. Would it be possible to introduce this feature and maybe make it somehow configurable, perhaps with a few example grammars included in the repository?

I took a brief look at the code, an perhaps a callback function that can modify what is being output would suffice.

Edit: I realize the end code block function is protected, which will work for me for the time, but it would be pretty good to have this be built into the library by default.

dregad commented 6 months ago

Just plug https://prismjs.com and you're done.