mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
fix(console): markdown toc links that contain special characters should work (#1543)
This commit is contained in:
parent
e06f8d027e
commit
1b056f125d
1 changed files with 5 additions and 1 deletions
|
@ -29,7 +29,11 @@ const Markdown = ({ className, children }: Props) => {
|
|||
return resolveIdCollision(kebabCaseString, index + 1);
|
||||
};
|
||||
|
||||
const initialKebabCaseString = text.replace(/\s/g, '-').toLowerCase();
|
||||
const initialKebabCaseString = text
|
||||
// Remove all symbols and punctuations except for dash and underscore. https://javascript.info/regexp-unicode
|
||||
.replace(/\p{S}|\p{Pi}|\p{Pf}|\p{Ps}|\p{Pe}|\p{Po}/gu, '')
|
||||
.replace(/\s+/g, '-')
|
||||
.toLowerCase();
|
||||
|
||||
return resolveIdCollision(initialKebabCaseString);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue