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

Defining colors in the Custom Previewer Tab #2197

Open
wabiloo opened this issue Nov 22, 2024 · 4 comments
Open

Defining colors in the Custom Previewer Tab #2197

wabiloo opened this issue Nov 22, 2024 · 4 comments
Labels
question Further information is requested

Comments

@wabiloo
Copy link

wabiloo commented Nov 22, 2024

Is there a way to assign colors to the Custom Previewer Tab?

In my use case, the response body is a complex JSON object, and I'd like to show a text-based overview of its content.
It works great (and I was pleasantly surprised to see that if using indentation, the tab automatically offers a way to collapse them, super useful!)

Screenshot 2024-11-22 at 12 11 40

What would be even better is if I could define colors to highlight specific things (eg. difference between keys and values in my screenshot). Is that possible today somehow?

@wabiloo wabiloo added the question Further information is requested label Nov 22, 2024
@NghiaTranUIT
Copy link
Member

@wabiloo Sorry, the customize tab currently doesn't support custom syntax highlighting.

If we have more requests for this change, we will implement it 👍


To workaround, you can write your syntax highlighting for VSCode, then open the file with VS Code

Screenshot 2024-11-23 at 9 05 33 AM

@NghiaTranUIT
Copy link
Member

If you want to use built-in JSON syntax highlight, you should build your body as a JSON. it will work

@wabiloo
Copy link
Author

wabiloo commented Nov 23, 2024

Does the custom tab assume JSON then?
No way to push HTML to it and have it rendered (which would give me another way)?

@NghiaTranUIT
Copy link
Member

For now, it tries to parse the content. If it can parse to the JSON, it will be rendered as a JSON with correct syntax highlighting. Otherwise, it renders as plain text.

We can support some built-in syntax highlighting from Monaco Editor, such as HTML, CSS, XML, .... which is easy to do.

To support customize syntax highlighting, it's more difficult because I need to compile the Monaco Editor at built time, including all available syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants