From 88fc05c67d51243f4f38603813d2e241cf8bc59e Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Tue, 8 Nov 2022 01:29:01 +0800 Subject: [PATCH] Dont anchor h4 --- .../CustomHTMLElements.utils.ts | 15 +++++++++------ apps/docs/components/index.tsx | 5 ----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/apps/docs/components/CustomHTMLElements/CustomHTMLElements.utils.ts b/apps/docs/components/CustomHTMLElements/CustomHTMLElements.utils.ts index b64d4ed8086..e1bc479e468 100644 --- a/apps/docs/components/CustomHTMLElements/CustomHTMLElements.utils.ts +++ b/apps/docs/components/CustomHTMLElements/CustomHTMLElements.utils.ts @@ -12,12 +12,15 @@ export const getAnchor = (text: any): string | undefined => { if (typeof x !== 'string') return x.props.children else return x.trim() }) - .map((x) => - x - .toLowerCase() - .replace(/[^a-z0-9- ]/g, '') - .replace(/[ ]/g, '-') - ) + .map((x) => { + if (typeof x !== 'string') return x + else + return x + .toLowerCase() + .replace(/[^a-z0-9- ]/g, '') + .replace(/[ ]/g, '-') + }) + return formattedText.join('-').toLowerCase() } else { const anchor = text.props.children diff --git a/apps/docs/components/index.tsx b/apps/docs/components/index.tsx index 56e0b9b3b2d..035b7fc610a 100644 --- a/apps/docs/components/index.tsx +++ b/apps/docs/components/index.tsx @@ -46,11 +46,6 @@ const components = { {props.children} ), - h4: (props: any) => ( - - {props.children} - - ), code: (props: any) => { const linesToHighlight = parseNumericRange(props.lines ?? '') return