Skip to content

Commit

Permalink
Preserve heading IDs for fragment links
Browse files Browse the repository at this point in the history
  • Loading branch information
eatyourgreens committed Sep 18, 2023
1 parent 1c6114d commit 1fabec3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/lib-react-components/src/Markdownz/Markdownz.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ export function renderMedia(nodeProps) {

const componentMappings = {
a: Anchor,
h1: ({ children }) => <Heading level='1'>{children}</Heading>,
h2: ({ children }) => <Heading level='2'>{children}</Heading>,
h3: ({ children }) => <Heading level='3'>{children}</Heading>,
h4: ({ children }) => <Heading level='4'>{children}</Heading>,
h5: ({ children }) => <Heading level='5'>{children}</Heading>,
h6: ({ children }) => <Heading level='6'>{children}</Heading>,
h1: ({ id, children }) => <Heading id={id} level='1'>{children}</Heading>,
h2: ({ id, children }) => <Heading id={id} level='2'>{children}</Heading>,
h3: ({ id, children }) => <Heading id={id} level='3'>{children}</Heading>,
h4: ({ id, children }) => <Heading id={id} level='4'>{children}</Heading>,
h5: ({ id, children }) => <Heading id={id} level='5'>{children}</Heading>,
h6: ({ id, children }) => <Heading id={id} level='6'>{children}</Heading>,
hr: () => <hr style={{ width: '100%' }} />,
img: renderMedia,
p: Paragraph,
Expand Down

0 comments on commit 1fabec3

Please sign in to comment.