Search code examples
phpmarkdownhtmlpurifierhtmlspecialchars

How do I stop HTMLpurifier from escaping PHP shorthand syntax examples in markdown?


I'm using markdown and HTMLpurifier and I want to have examples of shorthand PHP (<?= $variable ?>) in the markdown code (using the indent syntax) however HTMLpurifier is not recognizing the tag < as an allowed element and is escaping it.

Any idea what config option I need to enable in HTMLpurifier to stop it escaping this?


Solution

  • It's currently unsupported, you might be interested in joining this old thread from HTMLpurifier forums - PHP shorthand tag

    Another solution is to run your own str_replace to restore php sections if that is feasible and doesn't cause any security holes.