Comments cause line mis-spacing when they are multi-line comments

Steps to reproduce

Generally, comments have zero effect on the Preview rendering.
A few buggy examples do change the rendering:

Example 1:

## test
%% test test %%
test

renders differently than

## test
%% test 
test %%
test

Example 2:

test
%% test test%%
test

renders differently than

test
%% test 
test%%
test

Further investigation

I see that multi-line comments also erroneously spawn a blank <div></div> in the HTML. That could be a clue as to why it’s mis-calculating line spacings.

Expected result

1-line and 2-line comments should have the same effect on Preview - nothing.

Actual result

2-line comments change the Preview rendering.

Environment

  • Operating system: MacOS
  • Obsidian version: Latest

Additional information

The first 3 people in discord to try the bug also repro’d it.

+1 for the bug report. It also happens on Windows computers.
Quick modification on the bug though, for me it’s the 1-line comment that creates an empty div in Preview mode. And the 2-line comment behaves as expected.