Content formatting function?
-
I’m not really looking to create a plugin, just examine some of WordPress’s functionality to learn from it.
I’ve long wanted to know what techniques are commonly used in content management systems to convert blended text and HTML into full HTML. For example, when I make a post in WordPress, this might be what’s stored in the database:
Hi! This is my first paragraph. Here's a list: <ul> <li>Item 1</li> <li>Item 2</li> </ul> <strong>Here's a following paragraph.</strong> And another.When this content is formatted and displayed on the public page, the source code you really get is:
<p>Hi! This is my first paragraph. Here's a list:</p> <ul> <li>Item 1</li> <li>Item 2</li> </ul> <p><strong>Here's a following paragraph.</strong></p> <p>And another.</p>The formatting is intelligent enough to know when to convert line breaks to
, when to surround text with <p></p>, and when not to do either based on which HTML tags are used in the text itself.I was excited to dig into WordPress and find out how it accomplishes this. The problem is that my diligent trawl through the code to pinpoint where this formatting is executed has failed!
Does anyone know what function does this formatting and where it’s located? Or is there any online documentation of the core “engine” that will give me this information?
The topic ‘Content formatting function?’ is closed to new replies.