Closed
Description
i18next-scanner recently started using parse5 to process Trans element (see i18next/i18next-scanner#44). This is revealing something I had not taken into account: parse5 enforces some HTML behaviour that is not desirable for i18next-scanner. For example this input:
<Trans i18nKey="custom.label">
I agree with the
<Link to="/terms-and-conditions">terms and conditions</Link>
</Trans>
The parsed DOM looks like this:
[
{
"nodeName": "#text",
"value": "I agree to the "
},
{
"nodeName": "link",
"tagName": "link",
"attrs": [],
"namespaceURI": "http://www.w3.org/1999/xhtml",
"childNodes": []
},
{
"nodeName": "#text",
"value": "terms."
}
]
Since HTML requires <link>
is a void element parse5 this certainly makes sense. It just happens to break our specific use case. Is there a way to tell parse5 to skip enforcing HTML rules?