Math block delimiters breaking headings and links

Having one or both math delimiters in their own line, when the next bit of text is not preceded by a new line breaks following headings and sometimes links.

They still render fine in preview mode but they don’t show up in outline, heading links, and sometimes local graph. It also causes problems when exporting to html.

this issue is similar, but my blocks are not empty.

test.md (521 Bytes)
this is an example with only headings in sandbox vault.

This is easily circumvented by having both delimiters in line with something else, but it can be hard to notice, and may make notes invisible when trying to link to them.

2 Likes

Just to follow up on this and add a little to the OP’s problem: I can reproduce the same issue simply by starting a new math block on the same line as the end tag of a previous math block. Notice the $$$$ terminating the first math block and starting the second in the example.

Example:

## Heading A
Test Test

$$
E=mc^2
$$$$
s=ut+\frac{1}{2}at^2
$$

## Heading B
Test Test

## Heading C
Test Test
### Heading C.A
Test Test
## Heading D
Test Test

### Heading D.A
Test Test


If you try to add a header link using [[#]] you’ll only see Heading A in the list. If you put the start $$ of the second math block on a new line this corrects the issue.

It may be reasonable to expect that blocks always start on a new line but can be hard to understand/debug the issue on longer posts with lots of math and using the Live Previous mode.

  • Obsidian Version 1.5.12 (Installer 1.4.13), MacOS Sonoma 14.4.1.
1 Like

I have the same issue. For me the root cause are empty lines in LaTeX blocks.

# Normal heading

- some text

$$
\begin{align}
a^2 + b^2 = c^2\\

\lambda_\mathrm{D} = \sqrt{\frac{\epsilon_{0}k_\mathrm{B}T_\mathrm{e}}{n_\mathrm{e}e^2}}
\end{align}
$$

- some text

## Heading that is unlinkable but renders fine

- some text

Removing the empty line fixes the issue:

# Normal heading

- some text

$$
\begin{align}
a^2 + b^2 = c^2\\
\lambda_\mathrm{D} = \sqrt{\frac{\epsilon_{0}k_\mathrm{B}T_\mathrm{e}}{n_\mathrm{e}e^2}}
\end{align}
$$

- some text

## Heading that is linkable and behaves fine

- some text

This bug report is a duplicate of

@aaueer I can’t reproduce your problem. Open a separate BR and make sure you follow the BR template.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.