Swap dompurify for node-friendly version. #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this do?
Initial use of dompurify
😢 Initially, I opted to use
dompurify
as a package for rendering markup in #4. This works fine if Nectar is being used in a browser environment, however, showed issues on server side generation in a node environment in Next.js.Trial isomorphic-dompurify
😡 I then tried https://www.npmjs.com/package/isomorphic-dompurify however there is a specific issue regarding it related to Next.js that makes it unusable in that platform, see also kkomelin/isomorphic-dompurify#54 (comment).
Settled on sanitize-html
😃 So, now we are using https://www.npmjs.com/package/sanitize-html which seems to work in node environments. I've tested this Nectar build in Next.js using a local
npm link
and we should be good to go. There is a nice@types
package for this as well.