From 3417fdd3d7f86bcbd2d6941fb5bd4ac92ca83551 Mon Sep 17 00:00:00 2001 From: Emma Date: Wed, 21 Aug 2024 14:34:35 -0600 Subject: [PATCH] Fixes id creator making inaccurate ids --- lib/tcmd/TokenIdentifiers.tsx | 4 ++-- md/help articles/test.md | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/tcmd/TokenIdentifiers.tsx b/lib/tcmd/TokenIdentifiers.tsx index 1d40206..eb469aa 100644 --- a/lib/tcmd/TokenIdentifiers.tsx +++ b/lib/tcmd/TokenIdentifiers.tsx @@ -802,7 +802,7 @@ export const buildOnlyDefaultElements = () => { // on-demand resolver registerIdentifier( "on-demand resolver", - /\?\?\[.*?\]\(.*?\)<<(.*?)>>/g, + /\?\?\[.*?\](\(.*?\))<<(.*?)>>/g, (s) => { const inp = s.match(/(?<=<<)(.*?)(?=>>)/)![0]; const title = s.match(/(?<=\?\?\[)(.*?)(?=\])/)![0]; @@ -931,7 +931,7 @@ function search( function generateId(t: string, usedIds: string[]) { let id = t .toLowerCase() - .replace(/[^a-z\s]/gi, "") + .replace(/[^a-z\s-\d]/gi, "") .trim() .replaceAll(" ", "-"); let idNum = 1; diff --git a/md/help articles/test.md b/md/help articles/test.md index 1acaf3b..27e5c62 100644 --- a/md/help articles/test.md +++ b/md/help articles/test.md @@ -12,4 +12,9 @@ 3. my 4. name 5. is -6. welcome \ No newline at end of file +6. welcome + +- [-\_hello1234!@#$%^\&\*()-](#-_hello1234-) + + +# -_hello1234!@#$%^&*()-