Skip to content

Commit

Permalink
docs: Transform node.tagName is case sensitive (#266)
Browse files Browse the repository at this point in the history
It looked to me like all the `node.tagName`s were uppercase, even if the original HTML was in lowercase.

The `node.tagName === 'a'` in the example didn't work for me, but `node.tagName === 'A' or `node.tagName.toLowerCase() === 'a'` do.
  • Loading branch information
arcataroger authored Dec 19, 2023
1 parent 36117a7 commit 2bec321
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion website/docs/parser.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ For example, to replace `a` elements with a custom element:
import { Interweave, Node } from 'interweave';

function transform(node: HTMLElement, children: Node[]): React.ReactNode {
if (node.tagName === 'a') {
if (node.tagName === 'A') {
return <Link href={node.getAttribute('href')}>{children}</Link>;
}
}
Expand Down

0 comments on commit 2bec321

Please sign in to comment.