Pass language to the SourceViewer component
What does this MR do and why?
Passes the language field to the SourceViewer component so that we can pass it to highlight.js explicitly instead of relying on auto-detection. If a language cannot be mapped from Rouge to highlight.js we use the autodetect feature of highlight.js to determine the language.
:refactor_blob_viewer
and :highlight_js
feature flags.
Screenshots or screen recordings
language | screenshot |
---|---|
Java | |
JavaScript | |
C | |
Vue (autodetected) |
How to set up and validate locally
- Enable the Blob Viewer Refactor feature flag
Feature.enable(:refactor_blob_viewer)
- Enable the HighlightJS feature flag
Feature.enable(:highlight_js)
- View a source file
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #348145 (closed)
Edited by Jacques Erasmus