By default, anchor is not suitable for multilanguage in most situation, not only because the encoding is hard to "slugify", but also the "compatibility" between itself and "the standard upstream" 's URL. So when the website comes to be multilingual, it needs a way to fix the content of headings that it was (in English).
For example,
# Title
This is a file written in Markdown.
## The syntax
The new syntax I am using is `~~ anchor title`.
We are using markdown-it-anchor now right? So that we get two anchor: #title and #the-syntax.
By default, anchor is not suitable for multilanguage in most situation, not only because the encoding is hard to "slugify", but also the "compatibility" between itself and "the standard upstream" 's URL. So when the website comes to be multilingual, it needs a way to fix the content of headings that it was (in English).
For example,
We are using
markdown-it-anchor
now right? So that we get two anchor:#title
and#the-syntax
.After we translate it into, let's say,
zh-CN
:These the anchors turn to
#
(nothing),and it break down the links in other page.Using the specified-anchor syntax, we can write translations in this way:
The visible result is equivalent to the former one. The difference is there are the same anchors in the original one.