MyBB Community Forums

Full Version: MyCode adding <br> tags for line breaks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can i stop MYBB from adding <br> tags in MYCode for linebreaks?

So after modifying
class_parser.php of this if condition to comment out

       //if(!isset($this->options['nl2br']) || $this->options['nl2br'] != 0)
       //  $message = nl2br($message);
           // Fix up new lines and block level elements
       //  $message = preg_replace("#(</?(?:                                                            html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)\s*  <br />#i", "$1", $message);
       //  $message = preg_replace("#(&nbsp;)+(</?(?:                                                   html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)#i", "$2", $message);
This does what we want. It removes <br> tags. But it also removes br tags for the entire post. We want it to only remove the br tag within our syntax highlighted code defined in BBCode pre, which is just a replica of <pre> tag
[pre class="brush: python"]
print('hello world')