Copying a note as HTML adds extra `<br>` elements

As a standard Markdown editor, Bear generally* treats two newline characters between text as a paragraph delimiter. That means the following text

First paragraph.

Second paragraph.

should result in the following HTML

<p>First paragraph.</p>
<p>Second paragraph.</p>

When highlighting text in a note and choosing Copy As > HTML from the editor context menu, the result is correct.

However, when exporting as HTML (via the File menu or context menu in the note list) or copying an entire note as HTML (via the context menu in the note list), it incorrectly adds <br> line break elements between each paragraph (and between headings and paragraphs):

<p>First paragraph.</p><br>
<p>Second paragraph.</p>

This inconsistency is surely a bug. Thanks!


* The paragraph spacing user preference notwithstanding

BRs in the HTML file export are expected because it carries its styling and we had to rely on Ps and BRs for mirroring some editor features.

It’s not expected list copy behave as reported unless I’m missing something. The idea is copy as HTML is the tool providing plain HTML to be used for different scenarios and the file exports are for sharing. I’ll check if need to fix this for the next update.

Interesting. I would think that would be something CSS could handle. Is there a particular design or layout that you aren’t able to achieve with just CSS?

If I were to try making my own CSS for plain Commonmark-compiled HTML, does the Bear team have a “kitchen sink” note that has everything in it? Images, tables, different headers, things in different orders, etc.?

1 Like