add solidity syntax highlighting for *.sol files to content_editor & source_viewer
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Release notes
add solidity syntax highlighting for *.sol files to code preview
Problem to solve
we have a lot of solidity on our self hosted gitlab instance, but it has no syntax highlighting when i view those files. this makes the site a lot less useful for reading solidity. this is an issue for both public viewers who would like to read our code, and developers using the webui to review code, history, etc.
Proposal
I am happy to try to take on this task.
From my current research i think these things need to happen
- hooking and loading in the highlight.js solidity plugin, maybe in 'app/assets/javascripts/vue_shared/components/source_viewer/workers/highlight_utils.js' ? not sure how highlightjs plugins work. Maybe these files can be loaded through the existing plugin infra
- adding the mappings for rogue->highlightjs for solidity to 'app/assets/javascripts/vue_shared/components/source_viewer/constants.js'
- add solidity to code block languages in 'app/assets/javascripts/content_editor/constants/code_block_languages.js'
- add some sort of mapping for solidity in 'app/assets/javascripts/content_editor/services/highlight_js_language_loader.js'
The author of highlight.js seem against adding to the primary package - see https://github.com/highlightjs/highlight.js/issues/2047#issuecomment-568953924
Rogue seems to already supports solidity. (although it isnt listed on their website, it seems to be in the code)
If someone who knows more than me can confirm this all seems right, i can try putting together a PR.
Intended users
Anyone that reads solidity code.
Feature Usage Metrics
See how many people are viewing solidity files on gitlab instances.