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 kotlin syntax highlighting despite highlight.js support? #1275

Closed
maniyar1 opened this issue Jul 8, 2020 · 3 comments
Closed

No kotlin syntax highlighting despite highlight.js support? #1275

maniyar1 opened this issue Jul 8, 2020 · 3 comments
Labels
A-Highlighting Area: Code colored syntax highlighting

Comments

@maniyar1
Copy link
Contributor

maniyar1 commented Jul 8, 2020

Running into a problem where Kotlin code snippets are not properly being highlighted.
Here is a test repository to demonstrate (generated with current git version of mdBook).

This is fixed by dropping in a new version of highlight.js in the theme/ folder, but this is strange since according to the changelog Kotlin has been supported for a good while before the current version in mdBook (9.15).

In any case, it seems updating highlight.js is trivial, so I'd be totally open to PRing in the most recent version, just was wondering if anyone else had thoughts on this (especially since I know Kotlin isn't really a target language).

@ehuss
Copy link
Contributor

ehuss commented Jul 9, 2020

The default higlightjs uses the common languages and a few select extras. Kotlin isn't in the default set. A PR to update to add Kotlin would be fine, just make sure not to remove any languages currently included.

@ehuss ehuss added the A-Highlighting Area: Code colored syntax highlighting label Jul 9, 2020
@maniyar1
Copy link
Contributor Author

maniyar1 commented Jul 9, 2020

Ah, that's interesting and makes perfect sense. What's the criteria for being added? I doubt mdBook is being used that much for Kotlin code anyway, and the work-around is pretty simple.
Looking at their bundling it looks like now Kotlin is in their "common" bundle/set (not sure about phrasing), so I guess it might make sense to add it in. Is there a running list of the languages currently supported?

@ehuss
Copy link
Contributor

ehuss commented Jul 9, 2020

The criteria has generally been when someone asks for a new language.

I don't remember exactly what the list is. You can load the current highlight.js and search for all the calls to registerLanguage to get the complete list. According to #942 it is :common armasm d go handlebars haskell julia rust scala swift x86asm yaml, but I don't remember if that is a current list.

camelid added a commit to camelid/mdBook that referenced this issue Sep 29, 2020
Dylan-DPC-zz pushed a commit that referenced this issue Sep 29, 2020
* List supported Highlight.js languages in guide

Generated using the technique described in
#1275 (comment).

* Improve wording in guide
notriddle pushed a commit to notriddle/mdBook that referenced this issue Dec 23, 2021
* List supported Highlight.js languages in guide

Generated using the technique described in
rust-lang#1275 (comment).

* Improve wording in guide
rubenmoor pushed a commit to rubenmoor/mdBook that referenced this issue Aug 5, 2022
* List supported Highlight.js languages in guide

Generated using the technique described in
rust-lang#1275 (comment).

* Improve wording in guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Highlighting Area: Code colored syntax highlighting
Projects
None yet
Development

No branches or pull requests

2 participants