Skip to content

Highlight detection result data with MicroLighter - #157

Merged
turegjorup merged 4 commits into
developfrom
feature/detection-result-data-highlight
Sep 30, 2026
Merged

turegjorup merged 4 commits into
developfrom
feature/detection-result-data-highlight

Conversation

@turegjorup

Copy link
Copy Markdown
Contributor

Link to ticket

TODO: no ticket linked yet — please add before review.

Description

Highlight the JSON in the "Data" field of the detection result detail page with MicroLighter, instead of EasyAdmin's code editor field.

  • <micro-lighter language="json" controls="copy" line-numbers> from the microlighter npm package (MIT, about 2 kB gzipped), registered in assets/admin.js with the GitHub theme. It highlights with the CSS Custom Highlight API, so it adds no markup per token, and it gives the field line numbers and a Copy button.
  • The theme follows EasyAdmin's light/dark switch (ea-light-scheme / ea-dark-scheme on <body>) rather than the OS setting its light-dark() colours use.
  • The element loads grammars with import(./grammars/${language}.js) relative to the bundle, which Vite leaves as is. Reprise's copy option ships the 40 grammar files unhashed in public/build/grammars/; only json.js is fetched.
  • The field uses a new code_highlight.html.twig template with a language custom option, so it can be reused for other code.
  • DetectionResult::getPrettyData() now encodes with JSON_UNESCAPED_SLASHES and JSON_UNESCAPED_UNICODE, so paths and URLs read https://github.com/... instead of https:\/\/github.com\/....

Screenshots

TODO: light and dark.

Checklist

  • My code is covered by test cases.
  • My code passes our test (all our tests).
  • My code passes our static analysis suite.
  • My code passes our continuous integration process.

@github-actions

Copy link
Copy Markdown

API Specification - Non-breaking changes

No changelog changes

@turegjorup
turegjorup merged commit b6142fe into develop Sep 30, 2026
17 checks passed
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.70%. Comparing base (27d7dd2) to head (b03ac14).
⚠️ Report is 13 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #157      +/-   ##
=============================================
+ Coverage      64.55%   64.70%   +0.14%     
  Complexity      1269     1269              
=============================================
  Files            167      167              
  Lines           3939     3941       +2     
=============================================
+ Hits            2543     2550       +7     
+ Misses          1396     1391       -5     
Flag Coverage Δ
unittests 64.70% <100.00%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@turegjorup
turegjorup deleted the feature/detection-result-data-highlight branch September 30, 2026 22:16
@turegjorup turegjorup mentioned this pull request Sep 30, 2026
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