Description
Modifying of source HTML files and converting them again to JSX using HTMLtoJSX
requires a lot of manual work to re-apply custom changes made in JSX (e.g. set custom properties, strip out some tags, etc.). It's pretty annoying, when you need to periodically make multiple changes to source HTML files and it would be great to have a functionality to replace certain nodes or element attributes with custom code to automate compilation to JSX. In my case I convert a number of SVG files to React classes, where I need to strip out some meta tags and attributes and assign some calculated properties.
I propose to add two optional hooks to config: onNode
and onElementAttribute
which either return undefined (i.e. use default serializer) or a string that should be used to serialize nodes and attributes to the output JSX.
I prepared a PoC of this functionality here. Please take a look. If it's fine, I would make a PR.
Thanks.