How do I stop TipTap adding p tags to my li items?

I did some research around this and came to the following conclusion.

The default implementation of UL/OL in CodeMirror (which Tiptap uses under the hood) forces the use of a <p> element. There’s not simple configuration to disable this.

There are a couple of options

  1. Just accept it
    This would save you a lot of time :slight_smile:

  2. Hack the “Ordered List” plugin for Tiptap.
    This would require custom JavaScript to remove the built in Tiptap plugin for “List” and replace it with a custom one. This thread has some examples. However, the hack disables the possibility to create nested UL/OL lists in the editor which is not great. I did try this but it just felt wrong.

  3. Roll your own
    It would probably be technically possible to re-implement the “List” plugin for Tiptap (and CodeMirror) and replace the backoffice plugin that so that your custom implementation is used. CodeMirror feels complicated and I did not have days to invest in this so I did not go down this path.

What did I do?
I spent around 4 hours trying to get around it but ended up with “option” number 1 :slight_smile:

If anyone ever finds a solution that actually works with nested ULs I would be very interested to know more.

:rocket:

2 Likes