Editor: a "---" heading whose text is only math is a horizontal rule once an earlier line started with math

Steps to reproduce

Paste this into a note and compare Live Preview or Source mode with Reading view:

$a$ is the first line.

$b$
---

Then delete the first line and the blank line after it, and look again.

Did you follow the troubleshooting guide?

Yes (reproduced in the sandbox vault, no community plugins).

Expected result

$b$ underlined with --- is a level 2 heading (setext heading), in the editor as in Reading view and the outline.

Actual result

  • Reading view shows a level 2 heading b, and the metadata cache lists the heading $b$.
  • The editor shows a plain line b and a horizontal rule (Source mode styles the --- as a rule, not as a heading underline).
  • Once the first line is deleted, the editor shows the heading too.

What matters is that an earlier line started with math. With Intro. as the first line, the editor shows the heading. With $b$ in the title (math followed by more text) as the heading text, the editor shows the heading in both cases; only a heading line that is all math is affected.

Environment

SYSTEM INFO:
	Obsidian version: 1.14.5
	Installer version: 1.14.4
	Operating system: Windows 11 Pro 10.0.26300
	Login status: not logged in
	Language: en
	Insider build toggle: off
	Live preview: on
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on

RECOMMENDATIONS:
	none

Sandbox vault, no community plugins, default theme and settings.

Additional information

Live Preview: a line and a rule:

Reading view: a heading:

Live Preview without the first line: a heading:

The result depends on an unrelated line above, so the same heading renders differently depending on where it sits in the note.