user393964
user393964

Reputation:

How to work with wysiwyg generated code?

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 idea how to go about it.

Upvotes: 2

Views: 281

Answers (1)

Zed
Zed

Reputation: 3385

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.

Upvotes: 1

Related Questions