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

Enable Syntax Highlight and automatic formatting of JSON and XML #61

Merged
merged 4 commits into from
Mar 23, 2019
Merged

Enable Syntax Highlight and automatic formatting of JSON and XML #61

merged 4 commits into from
Mar 23, 2019

Conversation

micsco
Copy link
Contributor

@micsco micsco commented Mar 23, 2019

Adds support for syntax highlighting of XML and JSON files (#5)

  • Just JS/JSON and XML support enabled for now (to optimise JS size)
  • Does a shallow copy of the currentRequest (so that when changes are made the original is not overriden)
  • Enable formatting in the setCurrentRequest method
  • Adds XML pretty printing/formatting as well

Fixes #5
Fixes #60

@micsco
Copy link
Contributor Author

micsco commented Mar 23, 2019

@fredsted This works as I test it:
XML:
image

JSON:
image

@micsco
Copy link
Contributor Author

micsco commented Mar 23, 2019

Another JSON example with more types to show highlighting:
image

@@ -1,4 +1,5 @@
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
@import "node_modules/highlight.js/styles/github";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fredsted Are you happy with this as default style? Not sure what you wanted to use here; being able to choose would be great but added a level of complexity (plus additional preference to have somewhere)

I personally prefer a dark style

@micsco
Copy link
Contributor Author

micsco commented Mar 23, 2019

Added XML formatting too:

image

@micsco micsco marked this pull request as ready for review March 23, 2019 19:07
@micsco micsco changed the title Ms/syntax highlighting Enable Syntax Highlight and automatic formatting of JSON and XML (Fixes #5 and #60) Mar 23, 2019
@micsco micsco changed the title Enable Syntax Highlight and automatic formatting of JSON and XML (Fixes #5 and #60) Enable Syntax Highlight and automatic formatting of JSON and XML Mar 23, 2019
@fredsted
Copy link
Collaborator

Looks awesome! Great work. I think a lot of users will be happy about the XML formatting.

Regarding the theme, I'd like to keep it a bright theme so it fits with the rest of the app. I think an app-wide dark mode toggle would be nice.

@micsco
Copy link
Contributor Author

micsco commented Mar 23, 2019

Awesome, I haven't had a chance to test the limits of the formatters, but if you're happy with it go ahead and merge 👍

@fredsted
Copy link
Collaborator

Gave it a spin, and the only minor thing is that the formatting can't be toggled on/off immediately on the checkbox - if I want to see how the request looks unformatted, I have to turn formatting off and click back to another request. For me that's useful when you want to see exactly what's returned from the webhook.

I might try to fix this myself, but going to merge this for now.

Thanks again!

@fredsted fredsted merged commit 360063f into webhooksite:master Mar 23, 2019
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