Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitepress'
import languages from './languages'
import playground from './lib/cds-playground/index.js'
import { slugify } from './lib/slugify.ts'
import { Menu } from './menu.js'

const __dirname = dirname(fileURLToPath(import.meta.url))
Expand Down Expand Up @@ -46,10 +47,7 @@ const config = defineConfig({
},
anchor: {
// VS Code-compatible GitHub-style slugifier (mirrors markdown-language-features/src/slugify.ts)
slugify: (str) => str
.trim().toLowerCase()
.replace(/[^\p{L}\p{N}\p{M}\s_-]/gu, '')
.replace(/\s/g, '-'),
slugify,
},
container: { // Doesn't seem to work yet
infoLabel: 'Info',
Expand Down
8 changes: 8 additions & 0 deletions .vitepress/lib/slugify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// VS Code-compatible GitHub-style slugifier (mirrors markdown-language-features/src/slugify.ts).
// Used as VitePress' markdown anchor slugifier, and reused to derive heading anchors elsewhere (e.g. llms-full.txt).
export function slugify(str: string): string {
return str
.trim().toLowerCase()
.replace(/[^\p{L}\p{N}\p{M}\s_-]/gu, '')
.replace(/\s/g, '-')
}
Loading