Link to ModParagrapherParagrapher reformats the HTML generated from user posts so that it uses semantically correct <p></p> elements rather than <br> elements.
Features- 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.
SettingsTwo 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 ParagrapherForum 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'));
LicenseParagrapher 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.
ChangelogVersion 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:
- Initial submission to simplemachines.org