alsterholm/laravel-markdown

change &lt; &gt; < and > sign

hilmanski opened this issue · 2 comments

Hey ,

when i write a code inside triple backtick (```), it output the less than and greater sign as text.
so how can i change this '&lt;' and '&gt;' in code tag
since it auto turns &-sign to &amp;

i know i can use htmlspecialchars decode but it will allow a script to run

Hi,

This appears to be caused by Parsedown (the library we're using to parse markdown to HTML), which replaces & characters with &amp; in the parsed HTML.

Unfortunately, it seems that I can't do anything about it. I will, however, continue to research the matter and see if I can come up with a solution.

Best regards

Hi!

Like I mentioned earlier, this is a problem of the underlying Markdown parser used by default, which is erusev/parsedown.

If'd like, you can switch to a custom driver using the following method:

app('Indal\Markdown\Parser')->setDriver($driver);

The $driver has to be an object that implements the Indal\Markdown\Drivers\MarkdownDriver interface.