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

feat(gnoweb): prettify json code blocks in render #2033

Merged
merged 3 commits into from
May 7, 2024

Conversation

n0izn0iz
Copy link
Contributor

@n0izn0iz n0izn0iz commented May 3, 2024

Prettify JSON code blocks in gnoweb render

  • add hljs json language support
  • upgrade marked
  • add marked-highlight to plug marked with hljs
  • format json before highlighting
  • fix horizontal overflow in code blocks

Before

Screenshot 2024-05-03 at 19 42 59

After

Screenshot 2024-05-03 at 19 41 21
Contributors' checklist... - [ ] Added new tests, or not needed, or not feasible - [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [ ] Updated the official documentation or not needed - [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [ ] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).

Signed-off-by: Norman Meier <norman@samourai.coop>
@github-actions github-actions bot added the 📦 ⛰️ gno.land Issues or PRs gno.land package related label May 3, 2024
Copy link

codecov bot commented May 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.74%. Comparing base (143fa9c) to head (f943e00).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2033      +/-   ##
==========================================
- Coverage   48.44%   46.74%   -1.70%     
==========================================
  Files         409      492      +83     
  Lines       61965    69614    +7649     
==========================================
+ Hits        30019    32544    +2525     
- Misses      29446    34361    +4915     
- Partials     2500     2709     +209     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@moul moul requested a review from alexiscolin May 5, 2024 06:35
Copy link
Contributor

@leohhhn leohhhn left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this!

I think it might also be useful to add line numbers to the left of the box. Do you think you can add this?

@n0izn0iz
Copy link
Contributor Author

n0izn0iz commented May 7, 2024

I think it's better to do it in another PR, because it would also require to add a copy button if it hinders copying the content

There is hljs plugins for line numbers and copy button :D so it might be straightforward though

@leohhhn
Copy link
Contributor

leohhhn commented May 7, 2024

@alexiscolin WDYT?

@n0izn0iz
Copy link
Contributor Author

n0izn0iz commented May 7, 2024

I tried to add it quickly since it does not hinders copying but I have styling issues, I'll do it in another PR

Screenshot 2024-05-07 at 14 18 09

Copy link
Member

@alexiscolin alexiscolin left a comment

Choose a reason for hiding this comment

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

Cool 👍

@leohhhn leohhhn merged commit 1a2a879 into gnolang:master May 7, 2024
194 checks passed
@n0izn0iz n0izn0iz deleted the gnoweb-pretty-json branch May 7, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 ⛰️ gno.land Issues or PRs gno.land package related
Projects
Status: No status
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants