MyBB Community Forums

Full Version: Empty Line breaks in lists...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Check this out:

  1. Item 1
    Some description here.

  2. Item 2
    More description here.

Now what I want in the above list is line-break between "Some description here" and Item 2. However, I cannot accomplish it with unless I use some character on the next line (not space).

This works as I want, but with addition of that "dot".

  1. Item 1
    Some description here.
    .
  2. Item 2
    More description here.

I have noticed it again and again now and would like to have the functionality of being able to add new line breaks within the items of a list.

Personally, I have the following workaround. In class_parser.php, find:
$message = preg_replace("#\s*\[\*\]\s*#", "</li>\n<li>", $message);

Replace with:
$message = preg_replace("#\[\*\]#", "</li>\n<li>", $message);

Now that preserves the spacing.

Let's analyze the resulting html. By default, the following HTML is created:
<ol type="1">
<li>Item 1<br />
Some description here.</li>
<li>Item 2<br />

More description here.<br />
</li></ol>

After using the modified regex, the following is created:
<ol type="1">
<li>Item 1<br />
Some description here.<br />
<br />
</li>

<li>Item 2<br />
More description here.<br />
</li></ol>

Well, if a user is pressing enter key twice, and leaving 2 line-breaks in there, that's probably done on purpose... So why not allow them to have multiple line-breaks?

I was writing few articles, and they had few questions in the list format, however, it looked pretty ugly because of the line-breaks issues.
you can add to css style in theme:
li { padding-bottom: 16px; }

if you want have "hard" space (& nbsp), add new myCode:
\[sp\] translate to & nbsp; (without space)
this give you new code [sp].
Yeah well, the CSS way isn't really good enough for me since I need it only for few posts. But yeah thanks, second way of adding custom MyCode can work.

However, I think the formatting should be as user wants it. If users wants to add more spacing in between, they should be able to do so by just entering a line-break using the enter key, in the editor.
Asad_Niazi Wrote:If users wants to add more spacing in between, they should be able to do so by just entering a line-break using the enter key, in the editor.

this is html... Browser must ignore spaces, because they are used to format code. Only one way, if you want use x spaces, is put "& nbsp" html entity.

In typical forums html is disabled, so users can't use this - so you need too add myCode Smile and everything's good
Yes I understand that browsers ignore white-spaces Smile. It's not exactly that I am expecting line-break spacing by using white-spaces, it's rather by using line breaks. I haven't really spent much time figuring out what's the cause, but due to the use of that regex, line-breaks and spaces are removed somehow. But with the changed regex I posted, line-breaks and white-spaces are preserved.