Since internal HTMl is broken: How can I address a specific topic in my document?
This
[Link](#bla)
produces a correct link to a topic
## bla
But the link doesn't work
You could define a custom heading renderer.
Something along the lines of this? (psuedo code, untested, and you probably want a proper slug function instead of this one)
function Heading(props) {
const text = props.children.reduce(reduceTextChildren, []).join(' ')
const slug = text
.toLowerCase()
.replace(/\s+/g, '-')
.replace(/[^a-z-]/g, '')
return React.createElement(`h${props.level}`, {id: slug}, props.children)
}
<Markdown source="# Some *heading*" renderers={{heading: Heading}} />
// <h1 id="some-heading">Some <em>heading</em></h1>
Sorry, what is reduceTextChildren?
Disregard, stupid question
Most helpful comment
You could define a custom
headingrenderer.Something along the lines of this? (psuedo code, untested, and you probably want a proper slug function instead of this one)