vitepress
vitepress copied to clipboard
Show dynamic headers in aside outline
Describe the bug
If you use Vue-style interpolation in a markdown title (# in markdown), the aside curtain "On this page" will show the Vue syntax and not the final text. It will also not take into account the fact that multiple secondary title exists from a loop.
Reproduction
If you have a markdown file like this with a vfor loop and a interpolation of text for the heading:

# My great page
## {{element.subtitle}}
The output will show {{element.subtitle}} as text in the aside curtain "On this page".

Expected behavior
The output in the aside curtain "On this page" should be the string returned by Vue-style interpolation and take into account the multiple instance of the loop.

System Info
System:
OS: Windows 10 10.0.19044
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
Memory: 18.71 GB / 31.73 GB
Binaries:
Node: 18.2.0 - C:\Program Files\nodejs\node.EXE
npm: 8.9.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (102.0.1245.39)
Internet Explorer: 11.0.19041.1566
npmPackages:
vitepress: ^1.0.0-alpha.1 => 1.0.0-alpha.1
Additional context
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Putting Vue-style interpolations in Markdown headings also messes up automatic element IDs (for anchors).