Search code examples
typo3nested-listsrte

TYPO3 RTE list in list weird rendering


I am using TYPO3 7.6 and I have created a simple text content element with the following html markup:

<ol>
  <li>Hello World</li>
  <li>Hello World</li>
  <li>Hello World</li>
  <li>Hello World</li>
  <li>Hello World
    <ul>
        <li>Hello World</li>
        <li>Hello World</li>
        <li>Hello World</li>
    </ul>
  </li>
  <li>Hello World</li>
</ol>

As you can see I have created a nested list and it will be correctly saved, but if I inspect this nested list on frontend then I can see that TYPO3 do not render it correctly and adds empty p tags:

<ol>
  <p></p>
  <li>Hello World</li>
  <li>Hello World</li>
  <li>Hello World</li>
  <li>Hello World</li>
  <li>Hello World
    <p></p>
    <ul>
        <li>Hello World</li>
        <li>Hello World</li>
        <li>Hello World</li>
    </ul>
    <p></p>
  </li>
  <li>Hello World</li>
  <p></p>
</ol>

How can I avoid this empty p tags?


Solution

  • Adding the following typoscript to my setup works for me :)

    lib.parseFunc_RTE {
        externalBlocks {
            ol >
            ul >
            ol.stripNL = 1
            ol.stdWrap.parseFunc = < lib.parseFunc
            ul.stripNL = 1
            ul.stdWrap.parseFunc = < lib.parseFunc
        }
    }