Open SoylentGraham opened 3 hours ago
Steps to make custom language build
git clone https://github.com/highlightjs/highlight.js
npm install
highlight.js/src/languages
node tools/build.js -n wgsl
Then to integrate with my changes
build/highlight.js
to appmv highlight.js highlight_wgsl.js
// global
let highlighterInstance = Highlightr(highlightPath: Bundle.main.path(forResource: "highlight_wgsl", ofType: "js") )
// in view
CodeEditor(source: $layer.source, language:CodeEditor.Language(rawValue: "WGSL"), highlightr:highlighterInstance)
Also needed to change dependency of Highlightr
to use 2.2.1
to support current (11.10.0
) builds out of highlightr.js
I want to highlight a language that highlightr.js supports, but is not in this/https://github.com/raspu/Highlightr 's minified build of the js lib.
https://github.com/raspu/Highlightr seems to support a custom
highlight.js
build, in it's constructor, but I'm not seeing a way to set this up with this package.I presume that is the intended approach of using specific/additional languages, so the swiftui interface needs a way to pass the highlightr lib path down the chain