Inconsistent blank line behavior between headings and tables (bug or intended?)

What I’m trying to do

I want to place a heading (any level, # to ######) directly above a table, without a blank line in between.

This works if I write the heading first and then insert the table: the table is placed right below the heading, and it renders correctly.

But if I insert the table first and then try to write a heading on the line directly above it, a blank line is forced between the heading and the table.

I understand that a table usually needs a blank line above it when the previous line is a paragraph. But since a heading directly above a table works fine in the first case, I expected the second case to behave the same way.

Is this intended behavior, or is it a bug?

Things I have tried

  • Case 1: Typed a heading (e.g. # Title, ## Title), then inserted a table on the next line → no blank line, renders fine.

  • Case 1-2: Copied an existing table and pasted it on the line directly below a heading → also no blank line, renders fine.

  • Case 2: Inserted a table first, then typed a heading on the line directly above → a blank line is forced.

  • The same behavior occurs with all heading levels (# through ######).

  • Tested in the sandbox vault / with community plugins disabled: Yes

  • Obsidian version: 1.13.7, OS: windows 11, Editor mode: Live Preview