Skip to content

Commit dedb0d7

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents fca1501 + 129d969 commit dedb0d7

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

.vitepress/config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { fileURLToPath } from 'node:url'
88
import { defineConfig } from 'vitepress'
99
import languages from './languages'
1010
import playground from './lib/cds-playground/index.js'
11+
import { slugify } from './lib/slugify.ts'
1112
import { Menu } from './menu.js'
1213

1314
const __dirname = dirname(fileURLToPath(import.meta.url))
@@ -46,10 +47,7 @@ const config = defineConfig({
4647
},
4748
anchor: {
4849
// VS Code-compatible GitHub-style slugifier (mirrors markdown-language-features/src/slugify.ts)
49-
slugify: (str) => str
50-
.trim().toLowerCase()
51-
.replace(/[^\p{L}\p{N}\p{M}\s_-]/gu, '')
52-
.replace(/\s/g, '-'),
50+
slugify,
5351
},
5452
container: { // Doesn't seem to work yet
5553
infoLabel: 'Info',

.vitepress/lib/slugify.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// VS Code-compatible GitHub-style slugifier (mirrors markdown-language-features/src/slugify.ts).
2+
// Used as VitePress' markdown anchor slugifier, and reused to derive heading anchors elsewhere (e.g. llms-full.txt).
3+
export function slugify(str: string): string {
4+
return str
5+
.trim().toLowerCase()
6+
.replace(/[^\p{L}\p{N}\p{M}\s_-]/gu, '')
7+
.replace(/\s/g, '-')
8+
}

0 commit comments

Comments
 (0)