mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-06 03:15:03 +00:00
* expand parseHeadingId Will produce a kebab-case heading ID from string if none explicitly declared in the markdown. Always returns an object with the children, title and headingId. * remove redundant code from MDComponents.tsx parseHeadingIds now always returns an object with an ID, removing need for conditionals here * Use Box instead of flex Stack for MDX content Allows stacked vertical margins to properly collapse into each other * fix: h2 top margin to 3rem on mobile * remove unneeded line * extract and rename getKebabCaseFromName util fn * Update src/pages/[...slug].tsx * Update src/utils/parseHeadingId.ts Co-authored-by: Corwin Smith <cssmittys@gmail.com> * move constant inside function make variable name all caps as a string constant * clean up utils/index.ts to abc order Co-authored-by: Corwin Smith <cssmittys@gmail.com>
7 lines
182 B
TypeScript
7 lines
182 B
TypeScript
export const getKebabCaseFromName = (name: string): string =>
|
|
name
|
|
.replace(/[#]/g, '')
|
|
.trim()
|
|
.toLowerCase()
|
|
.replace(/ /g, '-')
|
|
.replace(/[^a-z0-9-]/g, '');
|