Bug: Editor Shows <p> Tag Too High

My Notes field generally consists of a number of paragraphs that I structure with <p>…</p>. The Editor shows these slightly too high: there’s more whitespace below than above the text.

Suppose a field consists of (say)


Compare this with


The one-word paragraph will be higher than the same word without <p> tags.

I’m on macOS 11.6. Addons are disabled. This did not occur before Anki 2.1.45.

This is on purpose. It makes the paragraph visually visible in the editor. If you have multiple paragraphs within a single field, you can tell them apart from <div> or <br>.

If you have certain fields, which always only contain one paragraph, I would suggest you put the the field within the card template into p tags, not inside the field.

Thank you for the elucidation. Good to know that it’s not a bug. I’ll get used to it.

I must confess though that I’m not entirely convinced that the reasoning is sound. If there’s only a paragraph or two, everything’s fine. But suppose for instance a field consists of paragraphs with some text preceding the first <p> – in that case, the two first parts won’t be properly visually distinguished from each other.

An illustration:

In that particular case I would assume that the text before should also be placed into a block-level container, like another p, or maybe dl.
It’s not an unpopular choice to remove the top margin of paragraph elements. Bootstrap also does it.

With a future feature update, the template CSS will likely be able to be used in the editor fields, which would make this configurable.

1 Like