erusev / parsedown

Better Markdown Parser in PHP

Home Page:https://parsedown.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom markup

grumpygamer opened this issue · comments

I have some custom replacements I want to do, but they can't happen in pre or code blocks. I can't do the replacements after the markdown has been done because it will replace them in code and pre blocks.

I assume this is a job for extensions, but I can't figure out how. Any advice?

I can't do the replacements after the markdown has been done because it will replace them in code and pre blocks.

You can do this way → https://stackoverflow.com/a/63653055/1163000

Make sure to extend the regex pattern to exclude code elements too:

'/(<code(?:\s[^>]*)?>[\s\S]*?<\/code>|<[^>]+>)/'