peternewnham / react-html-parser

Converts HTML strings directly into React components and provide a simple way to modify and replace the content.
https://peternewnham.github.io/react-html-parser
MIT License
781 stars 103 forks source link

Request: Transform option to add a classname or id to each parsed #65

Open GeorgeWL opened 5 years ago

GeorgeWL commented 5 years ago

I have seen instances where it was useful to have, and using the transformer feels like a much cleaner way than manually transforming the input string with string manipulation.

farhanjiwani commented 5 years ago

I could use this functionality as well

carlitosz commented 4 years ago

Still looking for a solution to this.

GeorgeWL commented 4 years ago

Shouldn't it be simple as

  1. Read existing classname, using the parser
  2. Append user-defined options.append.className
  3. done
earthnoob commented 4 years ago

I'm currently having problems with the parser itself, returning 'classname' instead of 'className' like the original string passed into it.

vishalashank commented 4 years ago

@earthnoob this is resolved here https://github.com/wrakky/react-html-parser/issues/29#issuecomment-333414171