MyBB Community Forums

Full Version: <p> instead of breaks in editor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When writing a new post all 'returns' on the keyboard are converted into <br>

But how can it be converted into <p>? Is there any setting to do this?
use javascript
MyBB (and most systems with user entry) uses nl2br() to convert returns into break.
If you want to change that, you'll have to change the core of MyBB to use a regexp, as you'll have to replace the beginning of line with <p> and the end of line with </p>.
(2024-01-17, 07:25 AM)Crazycat Wrote: [ -> ]If you want to change that, you'll have to change the core of MyBB to use a regexp, as you'll have to replace the beginning of line with <p> and the end of line with </p>.

That would be great. Maybe you can help me a little bit to realize this?

Do you know how the regex would have to look like?
^(.+)$ => <p>$1</p>
(2024-01-17, 02:58 PM)Crazycat Wrote: [ -> ]^(.+)$ => <p>$1</p>

Thanks Crazycat. 

I guess I need a little bit final help :-) (Where do I have to integrate the code?)
(2024-01-17, 02:58 PM)Crazycat Wrote: [ -> ]^(.+)$ => <p>$1</p>

What I don't understand how this regex-code recognizes where in a message a line starts and where it ends.