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

Support syntax highlighting for additional languages #275

Closed
thesamet opened this issue Aug 18, 2018 · 1 comment
Closed

Support syntax highlighting for additional languages #275

thesamet opened this issue Aug 18, 2018 · 1 comment

Comments

@thesamet
Copy link
Contributor

thesamet commented Aug 18, 2018

I'm trying to add an additional language (protobuf) to the syntax highlighter.

Currently, microsites supports only scala, java and bash. This is hard-coded in two places:

  1. highlight.pack.js is pre-built with support only for these languages.
  2. https://github.com/47deg/sbt-microsites/blob/a7b51de6643a5b14c325e1b7f7b176a64d1dcf99/src/main/scala/microsites/layouts/Layout.scala#L213-L217

One way to go about (1) is to allow users to bring their own highlight.pack.js. Maybe it is possible now? I couldn't find any documentation on this. Another way about it is to create a setting that would <script src> additional languages from https://cdnjs.com/libraries/highlight.js/ . This can not be accomplished today with CdnDirectives(jsList=...) since those scripts are sourced after hljs.configure()` gets called.

For (2), we can add an SBT key for micrositeHighlighterLanguages that defaults to Seq("scala", "java", "bash") for backwards compatibility. The same key should probably control the additional languages to download from the CDN.

Thoughts? Happy to send over a PR.

@juanpedromoreno
Copy link
Member

Thanks @thesamet , both options look good. Perhaps option 2 is more SBT/Scala friendly, in my opinion... And yes! any contribution is totally welcome :)

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

2 participants