Skip to content

Commit 7e78372

Browse files
committed
Prevent 500 in highlighting
1 parent 5baf589 commit 7e78372

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/dito/app/components/ParagraphList.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ function PrincipleHighlight(
2828
}
2929

3030
const parts = (children.props.children as string).split(/(\[\d\])/g);
31+
if (!parts[1]) {
32+
return parts[0]; // No matching principle tag, return unmodified content
33+
}
3134
const number = Number(parts[1][1]) as keyof typeof HIGHLIGHT_COLORS;
3235

3336
return principlesToShow.includes(number) ? (

0 commit comments

Comments
 (0)