Vitepress 自动生成中文outline 大纲id

在通过vitepress 写博客的时候,对于中文title 生成的outline 大纲无法正常跳转,我们必须手动的去为中文title 设置一个英文id, 如下:

Custom anchors

To specify a custom anchor tag for a heading instead of using the auto-generated one, add a suffix to the heading:

# Using custom anchors {#my-anchor}

This allows you to link to the heading as #my-anchor instead of the default #using-custom-anchors.

对于大篇幅的文档内容来说这显然是一件比较麻烦的事情,官方对此也没有具体的方案。

对此我们可以修改源码来解决这个问题:

自动生成自定义ID,这样就不必对文档中的中文标题手动生成title id

但次方法比较“暴力” 

猜你喜欢

转载自blog.csdn.net/SAXX2/article/details/132804824