Closed NielsH closed 10 years ago
Converting newlines to <br>
tags is not part of the api. If you want to do this step when rendering bbcode, you should do it yourself after parsing the bbcode. Adding this would break existing applications which don't expect this behavior and make it more difficult for applications that don't desire this functionality.
Hello,
Would it be possible to replace all newlines with linebreaks? I load submitted content through this parser, but by default all the newlines submitted by users are ignored. To display them via HTML they must be replaced with
's
http://www.php.net/manual/en/function.nl2br.php could be used for this.
e.g. Add above https://github.com/jbowens/jBBCode/blob/master/JBBCode/Parser.php#L156
$str = nl2br($str);
However my PHP isn't all that great so there may be better ways to do this.
EDIT: I added it in a pull request.... First time I've done this hope I'm not messing things up lol :)