Title: Content formatting function?
Last modified: August 19, 2016

---

# Content formatting function?

 *  [tarsus](https://wordpress.org/support/users/tarsus/)
 * (@tarsus)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/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?

Viewing 1 replies (of 1 total)

 *  Thread Starter [tarsus](https://wordpress.org/support/users/tarsus/)
 * (@tarsus)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/content-formatting-function/#post-1422693)
 * Whoops! In the paragraph that starts “The formatting is . . .”, that’s supposed
   to be:
 * `convert line breaks to <br />`

Viewing 1 replies (of 1 total)

The topic ‘Content formatting function?’ is closed to new replies.

## Tags

 * [format](https://wordpress.org/support/topic-tag/format/)

 * 1 reply
 * 1 participant
 * Last reply from: [tarsus](https://wordpress.org/support/users/tarsus/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/content-formatting-function/#post-1422693)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
