开发者

How to work with wysiwyg generated code?

开发者 https://www.devze.com 2023-02-16 11:38 出处:网络
I want to use the same editor as SO has on a site of mine, the user should also be able to type code, which is stored in the database. But there\'s something I don\'t understand:

I want to use the same editor as SO has on a site of mine, the user should also be able to type code, which is stored in the database. But there's something I don't understand:

How do I make the difference between markup (p, strong, li)-tags and code that should be shown as code and not interpreted by the browser?

When I store the submitted data in the database, I'll call the htmlentities function, and this will affect every tag: markup generated wy the wmd editor, and also html code (or other language) posted by the user.

Any information on this please? I really have no 开发者_如何学Goidea how to go about it.


Why are you calling htmlentities function when you store it in the database?

This is what breaks your markdown. I mean markup. Well, both actually.

0

精彩评论

暂无评论...
验证码 换一张
取 消