When I add an OL or UL using the Writer field, it automatically adds
tags in between the
<ul>
<li><p>Listitem</p></li>
<li><p>Listitem</p></li>
</ul>
When I add an OL or UL using the Writer field, it automatically adds
tags in between the
<ul>
<li><p>Listitem</p></li>
<li><p>Listitem</p></li>
</ul>
This is a known Prosemirror issue: Bug: list items contain <p> tags in writer field · Issue #3506 · getkirby/kirby · GitHub
If you want to get rid of the p tags, you would have to filter them out at render time.
How do I do this just for a list-item?
Replace the patterns <li><p>
with <li>
and </p></li>
with </li>
Is this one still unsolved? At least to me it’s a big issue because it brings wrong semantics.
Looks like it
It’s a feature, not a bug!
The intended behaviour for lists, in John Gruber’s original Markdown syntax:
“If list items are separated by blank lines, Markdown will wrap the items in
<p>
tags in the HTML output”
— from John Gruber’s original docs (Daring Fireball: Markdown Syntax Documentation)
So, to prevent unwanted <p>
tags, you just need to avoid blank lines between list items in your markup.
As far as I know this behaviour is adhered-to in Commonmark, GitHub-flavoured Markdown, ProseMirror (used I think in Kirby’s Writer field), and Parsedown (used in Kirby’s original Markdown field). The latter responds to a single blank line in the list markup, but ProseMirror seems to require a blank line between every list item.
I accidentally discovered this feature months after first using Markdown, and it still seems surprisingly little known, or used. But it’s a terrific feature that enables us to target lists in Markdown with two completely separate stylings.
I’ve written enthusiastically about this in my personal blog at: A sample post with everything in it, at brianliddell.com , including examples of how it can be used.
I hope this answers your question, and that I’ve not made any mistakes!