From 4161d41795d939b1f215fb0a03f018b6ff2e4730 Mon Sep 17 00:00:00 2001 From: 0div Date: Wed, 27 Nov 2024 09:57:21 -0800 Subject: [PATCH] fix anchor link generator for camel cased acronyms --- apps/web/prebuild.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/web/prebuild.js b/apps/web/prebuild.js index ff1b60951..169d025c4 100644 --- a/apps/web/prebuild.js +++ b/apps/web/prebuild.js @@ -49,7 +49,9 @@ function toAnchorLink(title) { // Remove special characters except dashes and spaces title = title.replace(/[^a-zA-Z0-9\- ]/g, '') // Add dashes between words for camelCase - title = title.replace(/([a-z])([A-Z])/g, '$1-$2') + title = title + .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2') + .replace(/([a-z])([A-Z])/g, '$1-$2') return '#' + title.toLowerCase().replace(/ /g, '-') }