Skip to content

Commit 94e3b25

Browse files
author
Quang Phan
committed
chore(toc): limit textContent to 100 max length for slugify
1 parent aaab896 commit 94e3b25

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.changeset/cool-meals-taste.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@svelte-put/toc': patch
3+
---
4+
5+
slice textContent to 100 max length before passing to slugify

packages/actions/toc/src/lib/toc.action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export const toc: Action<HTMLElement, UserTocParameters, TocAttributes> = functi
176176
if (dataTocId) {
177177
tocId = dataTocId;
178178
} else if (!tocId) {
179-
element.id = tocId = slugify(text);
179+
element.id = tocId = slugify(text.slice(0, 100));
180180
}
181181

182182
if (scrollMarginTop) {

0 commit comments

Comments
 (0)