Dont anchor h4

This commit is contained in:
Joshen Lim
2022-11-08 01:29:01 +08:00
parent d969cc94af
commit 88fc05c67d
2 changed files with 9 additions and 11 deletions

View File

@@ -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