Skip to content

Customize special characters to encode? #100

Description

@jaslong

We have a use case where we'd like to write JSON into HTML attributes, and we'd like to use html-entities to do this safely.

One problem is that encoding JSON makes it very hard to read since all quotes are encoded.

<div data-user="{&quot;name&quot;:&quot;Conan O&#39;Brien&quot;,&quot;age&quot;:99}"></div>

If we could skip decoding the double quote...

<div data-user='{"name":"Conan O&#39;Brien","age":99}'></div>

Do you think a change to customize the regexp of encoded characters makes sense? Alternatively, you could convince me that this is a bad idea :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions