yzhang-gh / vscode-markdown

Markdown All in One
https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
MIT License
2.91k stars 322 forks source link

Math Environment Breaks Table of Contents #1462

Open Enough7 opened 1 week ago

Enough7 commented 1 week ago

What's the problem

Hey, I just noticed a weird bug. It will probably occur very rarely.

Given the following file:

# Regression
$$
\end{bmatrix*} \\
=
$$

will print this Table of Contents

- [Regression](#regression)
- [\\end{bmatrix\*} \\](#endbmatrix-)

What's the expected result

- [Regression](#regression)

How to reproduce

  1. Enter:
    # Regression
    $$
    \end{bmatrix*} \\
    =
    $$
  2. Enter CTRL + P and run command markdown.extension.toc.create

Other information

If a new line is inserted after the \end{bmatrix*} \\ it works just fine. Like:

# Regression
$$
\end{bmatrix*} \\

$$