Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No API to add a language/custom highlightr js source #35

Open
SoylentGraham opened this issue Nov 16, 2024 · 2 comments
Open

No API to add a language/custom highlightr js source #35

SoylentGraham opened this issue Nov 16, 2024 · 2 comments

Comments

@SoylentGraham
Copy link

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

SoylentGraham added a commit to NewChromantics/CodeEditor that referenced this issue Nov 16, 2024
@SoylentGraham
Copy link
Author

SoylentGraham commented Nov 16, 2024

Steps to make custom language build

Then to integrate with my changes

  • Add new build/highlight.js to app
  • mv 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)

@SoylentGraham
Copy link
Author

SoylentGraham commented Nov 16, 2024

Also needed to change dependency of Highlightr to use 2.2.1 to support builds from the current version (11.10.0) of highlightr.js

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

No branches or pull requests

1 participant