cebe / markdown

A super fast, highly extensible markdown parser for PHP
http://markdown.cebe.cc/
MIT License
997 stars 141 forks source link

修复:已经存在的实体会被二次转义 #141

Closed allowing closed 7 years ago

allowing commented 7 years ago

htmlspecialchars() 传递最后一个参数,使已经存在的实体不再二次转义

<

以上的代码中,&符号会再次被转义成 & 当传递了最后一个参数为false时,会把<看成一个整体,不会仅仅把&转义。 在此多有得罪了,谢谢您宝贵的时间!

cebe commented 7 years ago

I think this is expected behavior. If you write code about HTML, the code should show up exactly as it has been written in the code block. E.g.:

< is an HTML entity.

should show up exactly as above and not as < is an HTML entity.

There are also tests covering this behaviors, which are failing with your change: https://travis-ci.org/cebe/markdown/jobs/212476763#L230-L234

Thanks for the contribution anyway!