Skip to content

Commit

Permalink
Add ballerina highlightjs support (exercism#6381)
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
ErikSchierboom authored Oct 25, 2023
1 parent b45a3db commit 9591ed3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/javascript/declarations/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,10 @@ declare module '@gleam-lang/highlight.js-gleam' {

export default setup
}

declare module '@ballerina/highlightjs-ballerina' {
import { LanguageFn } from 'highlight.js'
const setup: LanguageFn

export default setup
}
2 changes: 2 additions & 0 deletions app/javascript/utils/highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import setupCobol from 'highlightjs-cobol'
import setupBqn from 'highlightjs-bqn'
import setupZig from 'highlightjs-zig'
import setupGleam from '@gleam-lang/highlight.js-gleam'
import setupBallerina from '@ballerina/highlightjs-ballerina'

highlighter.default.registerLanguage('abap', setupABAP)
highlighter.default.registerLanguage('cobol', setupCobol)
highlighter.default.registerLanguage('bqn', setupBqn)
highlighter.default.registerLanguage('zig', setupZig)
highlighter.default.registerLanguage('gleam', setupGleam)
highlighter.default.registerLanguage('ballerina', setupBallerina)

highlighter.default.configure({
throwUnescapedHTML: true,
Expand Down
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const config = {
transform: {
'^.+\\.[t|j]sx?$': 'babel-jest',
},
transformIgnorePatterns: ['node_modules/(?!(highlightjs-(bqn|zig))/)'],
transformIgnorePatterns: [
'node_modules/(?!(highlightjs-(bqn|zig)|@ballerina/highlightjs-ballerina)/)',
],
moduleNameMapper: {
'^[./a-zA-Z0-9$_-]+\\.svg$':
'<rootDir>/app/javascript/images/GlobalImageStub.js',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "exercism",
"private": true,
"dependencies": {
"@ballerina/highlightjs-ballerina": "^1.0.1",
"@bugsnag/js": "^7.10.0",
"@bugsnag/plugin-react": "^7.10.0",
"@codemirror/basic-setup": "^0.19.0",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,11 @@
"@babel/helper-validator-identifier" "^7.16.7"
to-fast-properties "^2.0.0"

"@ballerina/highlightjs-ballerina@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@ballerina/highlightjs-ballerina/-/highlightjs-ballerina-1.0.1.tgz#ba053daf89a04ae0811157d5581ef76148226049"
integrity sha512-FOgWHYLhNhAk0i9gjB8+K2x52lGN44xLgvCNYduoQzPFG89qwtEtFk3guE8w8v7xRUNno6mlqn2bF6dG316mYg==

"@bcoe/v8-coverage@^0.2.3":
version "0.2.3"
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
Expand Down

0 comments on commit 9591ed3

Please sign in to comment.