-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The anchor doesn't work if there's an “й” in it. #4605
Comments
Hmm, the anchor for heading is being normalized but the link isn't. Bit tricky to solve. A workaround is to specify normalized version - // .vitepress/config.ts
import { defineConfig } from 'vitepress'
export default defineConfig({
markdown: {
anchor: {
slugify: (s) => s.replace(/\s+/g, '-').toLowerCase()
}
}
}) markdownlint uses this function which used to be the one that github used 👀 slugify: (s) =>
s
.toLowerCase()
.replace(/[^\p{Letter}\p{Mark}\p{Number}\p{Connector_Punctuation}\- ]/gu, '')
.replace(/ /gu, '-') vscode uses this: |
@brc-dd I use const data1 = 'движок-авто'
const data2 = 'настройки-сессии'
const deburr = await import('https://cdn.jsdelivr.net/npm/[email protected]/+esm').then(m => m.default?.deburr || m.deburr)
console.log(deburr(data1.normalize('NFD'))))
// движок-авто
console.log(deburr(data2.normalize('NFD')))
// настроики-сессии |
On firefox you can go to here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize, and replace Try it code with this one and run it: const data1 = 'движок-авто'
const data2 = 'настройки-сессии'
import('https://cdn.jsdelivr.net/npm/[email protected]/+esm').then(m => m.default?.deburr || m.deburr).then((deburr) => {
console.log(deburr(data1.normalize('NFD')))
// движок-авто
console.log(deburr(data2.normalize('NFD')))
// настроики-сессии
}) |
No actually we need This is what github generates: (which is similar to markdownlint's function) ![]()
|
Describe the bug
The anchor doesn't work if there's an “й” in it.
Reproduction
Please test. "Движок авто" works fine, but "Настройки сессии" will not scroll down
Expected behavior
works as other words
System Info
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: