Hi @m.finamor,
Thanks! This works but doesn’t loop through the IDs, so that every <h2>
tag has the same ID.
However, when I use the key
property (which is hinted at in the docs) I can render the <h2>
tags with unique IDs:
const renderOptions = {
customNodeRules: [
renderNodeRule(isHeading, ({ adapter: { renderNode }, key, children }) => {
return renderNode(`h2`, { id: `heading-${key}` }, children)
}),
],
}
The result then looks something like this:
<h2 id="heading-t-0">…</h2>
<p>…</p>
<p>…</p>
<h2 id="heading-t-3">…</h2>
This is not exactly what I was looking for, which is more like this:
<h2 id="heading-t-0">…</h2>
<p>…</p>
<p>…</p>
<h2 id="heading-t-1">…</h2>
However, I can work with it.
Thank you!