Skip to content

Ability to pass options to htmlparser2 #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chrisbateman opened this issue Jan 17, 2017 · 3 comments · Fixed by #35
Closed

Ability to pass options to htmlparser2 #34

chrisbateman opened this issue Jan 17, 2017 · 3 comments · Fixed by #35

Comments

@chrisbateman
Copy link

In order to set set decodeEntities to true, for example.

I think that the call to htmlToDOM on this line just needs to pass in a 2nd parameter with options: https://github.com/remarkablemark/html-react-parser/blob/master/index.js#L21

@remarkablemark
Copy link
Owner

That's a good point.

If decodeEntities is true by default, then would passing options to htmlparser2 still be a desirable feature?

@chrisbateman
Copy link
Author

That's the only one I needed.

htmlparser does have some other options though: https://github.com/fb55/htmlparser2/wiki/Parser-options

@remarkablemark
Copy link
Owner

For now, I will set decodeEntities to true by default and when the use-case for setting additional options arises, I'll then decide how the feature should be added.

My rationale for this is because html-react-parser is an isomorphic library so if the parsing were to change on node, then I need to ensure that the same change occurs on the browser (htmlparser2 is not loaded nor used on the client as there's no need).

remarkablemark added a commit that referenced this issue Jan 26, 2017
Decode HTML entities by default in `htmlparser2` (#34)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants