Skip to content

Commit 14c50da

Browse files
committed
removing   from toc slug and text
1 parent faf6b3b commit 14c50da

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

server/utils/changelog/markdown.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ export async function changelogRenderer() {
4444
const id = `user-content-${releaseId}-${uniqueSlug}`
4545

4646
// Collect TOC item with plain text (HTML stripped)
47-
const plainText = text.replace(/<[^>]*>/g, '').trim()
47+
const plainText = text
48+
.replace(/<[^>]*>/g, '')
49+
// remove non breaking spaces
50+
.replace(/&nbsp;?/g, '')
51+
.trim()
4852
if (plainText) {
4953
toc.push({ text: plainText, id, depth })
5054
}

server/utils/readme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ export const ALLOWED_ATTR: Record<string, string[]> = {
185185
*/
186186
export function slugify(text: string): string {
187187
return text
188+
.replace(/&nbsp;?/g, '') // remove non breaking spaces
188189
.replace(/<[^>]*>/g, '') // Strip HTML tags
189190
.toLowerCase()
190191
.trim()

0 commit comments

Comments
 (0)