Incomplete outline in notes with latex

Steps to reproduce

Add a latex block (not inline latex) directly after a text (1) or inside a comment (2). All titles and subtitles after the latex block stop being updated in the outline side panel.
1)

some text $$equation$$

2)

> comment
> $$
equation
> $$

or

> comment
> $$ equation $$

Did you follow the troubleshooting guide? [Y/N] Y

Environment

SYSTEM INFO:
	Obsidian version: v1.6.7
	Installer version: v1.5.3
	Operating system: Darwin Kernel Version 19.6.0: Tue Jun 21 21:18:39 PDT 2022; root:xnu-6153.141.66~1/RELEASE_X86_64 19.6.0
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Restricted mode: off
	Plugins installed: 9
	Plugins enabled: 3
		1: Periodic Notes v0.0.17
		2: Calendar v1.5.10
		3: Advanced Tables v0.22.0

RECOMMENDATIONS:
	Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.


Additional information

Also happens on Linux (Flatpak, AppImage), same Obsidan version.

In a quick test, this breaks, i.e., doesn’t show the following headings in the Outline tab:

> comment
> $$
  \begin{vmatrix}a & b\\ c & d \end{vmatrix}=ad-bc 
  $$

The headings are fine using this, but you end up with an unwanted > in the math block.

> comment
> $$
  \begin{vmatrix}a & b\\ c & d \end{vmatrix}=ad-bc 
> $$

These seem working and the headings are fine:

> comment $$\begin{vmatrix}a & b\\ c & d \end{vmatrix}=ad-bc$$

> comment
> $$
  \begin{vmatrix}a & b\\ c & d \end{vmatrix}=ad-bc$$

Related: