Skip to content
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

Escape special characters in strings to render as expected for json #45

Closed
wants to merge 2 commits into from

Conversation

aaroncannoncv
Copy link
Contributor

@aaroncannoncv aaroncannoncv commented Oct 23, 2024

Fixes escape sequence characters not rendering correctly in strings/keys.

If a json string contains "\n" then it would be expected that the display of the json string would show "\n" rather than an actual new line (within a <pre> tag) or a space (within most other html tags). This updates how these values are displayed (but not the underlying value).

As an aside, it is possible to edit a string and add such characters into the string however this can't be done by directly typing them (AutosizeTextarea automatically escapes these characters meaning typing "\n" is stored in the json as "\n" which is not what we want). But pressing enter creates a "\n" and other special escape sequences can be copied in.

I ran the linter to ensure code formatting was valid. There are still some formatting changes in the PR that aren't covered by standard --fix.
Also, the pre-commit check (standard --fix) was failing for issues completely unrelated to my changes so I committed with --no-verify.

Copy link

vercel bot commented Oct 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-json-view ❌ Failed (Inspect) Oct 23, 2024 3:27pm

@Kikobeats
Copy link
Member

Thanks for this! I did some minor changes. Since I can't push in your PR, I created a new one #46 🙂

@Kikobeats Kikobeats closed this Oct 25, 2024
@Kikobeats Kikobeats mentioned this pull request Oct 25, 2024
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 this pull request may close these issues.

2 participants