Additional Info
Package ID
First Created
December 07, 2015, 03:34:28 PM
Last Updated
July 05, 2023, 01:22:54 AM

Paragrapher v2.6

Render posts using semantically correct <p></p> elements instead of <br /> element
Compatible With 2.0.11, 2.0.15, 2.0.17, 2.0.18, 2.0.19, 2.1 RC1, 2.1 RC2, 2.1 RC3, 2.1 RC4, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4
Latest version v2.6
Downloads 732
Reviews 0
Rating 0/5
Subscribers 6
License GNU General Public License v2.0 (View License)

Paragrapher reformats the HTML generated from user posts so that it uses semantically correct <p></p> elements rather than <br> elements.


  • Intelligently converts line breaks into paragraphs.
  • Admin can choose whether to preserve the original visual layout or to normalize it.
  • The content of [code][/code], [pre][/pre], and [php][/php] BBCodes is always left untouched.
  • Does not modify the content of posts in the database.
  • Does not interfere with the editor.
  • Does not interfere with BBCode parsing.
  • Acts on posts and personal messages within the forum, in RSS feeds, and via SSI.
  • Can be extended and integrated with other mods and custom code with very little work.

Because Paragrapher never modifies the content of any stored data, you can freely install, uninstall, or change the settings at any time without consequences.


Two admin settings are available in Administration Center ► Modification Settings ► Miscellaneous:

  • Normalize layout when formatting paragraphs: Enabling this will collapse extra lines of white space between paragraphs, resulting in more consistent formatting in the output. Leave it disabled to preserve the original visual layout.
  • Allow single line breaks to create new paragraphs: This offers three options.
    • Never: (Default) Users must always enter at least two line breaks to create a new paragraph.
    • Always: One line break will be enough to create a new paragraph.
    • Intelligently: (Recommended) Paragrapher will attempt to analyze and adapt to the author's writing style when making this decision for each post.

Extending Paragrapher

Forum admins and even other mods can easily integrate Paragrapher into their code wherever they like.

If you want Paragrapher to process a string of text stored in a variable called $str, paste the following into your code at an appropriate point in the relevant PHP file:
call_integration_hook('integrate_paragrapher_string', array(&$str));
If you have some data in an array called $foo, and you want Paragrapher to process its 'desc' element, use this:
call_integration_hook('integrate_paragrapher_post', array(&$foo, 'desc'));
If you have an multidimensional array called $bar, and you want Paragrapher to process the 'body' element of every sub-array inside $bar, use this:
call_integration_hook('integrate_paragrapher_posts', array(&$bar, 'body'));


Paragrapher uses code derived from WordPress, and is therefore released under the GPLv2 (or later). A copy of this license in included in the package file.


Version 2.6:
  • Correctly handles strings with a single leading <br> element.

Version 2.5:
  • Fixes a bug where setting "Allow single line breaks to create new paragraphs" to "Intelligently" behaved like "Always" on SMF 2.1

Version 2.4:
  • Fixes an "undefined index" error when searching on SMF 2.0

Version 2.3:
  • Improves content handling for some less common HTML elements
  • Avoids creating unnecessary <p> elements inside <li>, <td>, etc.
  • Improves code efficiency

Version 2.2:
  • Posts no longer appear "un-paragraphed" after using the Quick Edit button. (Previously it was necessary to refresh the page after using Quick Edit.)
  • Ignores the content of [php][/php] BBCodes
  • Fixes a bug with handling <hr> elements
  • Improves code efficiency

Version 2.1:
  • Adds Latin Spanish translation

Version 2.0:
  • Adds a new option to control handling of single line breaks
  • Improves handling of preserved line breaks when not using the "normalize layout" option
  • Improves handling of paragraphs inside list items
  • Supports SMF 2.1
  • Rewritten to use integration hooks everywhere
    • Uses standard integration hooks on SMF 2.1
    • Creates custom integration hooks on SMF 2.0
  • Declares several generic integration hooks to enable easy integration with other mods and custom code
  • Makes some minor CSS improvements

Version 1.1:

Version 1.0.1:
  • Replaces "preserve layout" option with "normalize layout" option

Version 1.0:
18.18 KB v2.6 2.0.19, 2.1.1
Manual installation info
You have to register or login to be able to leave a review
There are currently no reviews on this customization