You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After to digging around a little because my transform function wasn't working like I expected based from the docs example, I thought offering a suggestion would be helpful.
Since the reference a tagName === 'a', I expected just that, a lowercase 'a'. But turns out tagNames are actually uppercase. So maybe one of the following changes?
function transform(node: HTMLElement, children: Node[]): React.ReactNode {
if (node.tagName === 'A') {
return <Link href={node.getAttribute('href')}>{children}</Link>;
}
}
OR
function transform(node: HTMLElement, children: Node[]): React.ReactNode {
if (node.tagName.toLowerCase() === 'a') {
return <Link href={node.getAttribute('href')}>{children}</Link>;
}
}
The text was updated successfully, but these errors were encountered:
Hey there! Awesome library!
After to digging around a little because my transform function wasn't working like I expected based from the docs example, I thought offering a suggestion would be helpful.
Since the reference a
tagName
=== 'a', I expected just that, a lowercase 'a'. But turns outtagNames
are actually uppercase. So maybe one of the following changes?OR
The text was updated successfully, but these errors were encountered: