Is there any way to disable the syntax highlighting engine’s ability to auto select the language? I am trying to get a block of Swift code highlighted on my install of Discourse:
I’m flanking the code fence with ~~~swift...~~~ but that’s not working.
but the highlighting engine insists on highlighting it as either makefile or nginx. My website only really uses a handful of languages (Xojo, Python, C# and Swift). Is there a way to remove / unload the unnecessary languages loaded by Discourse?
Using swift</code> or <code> swift doesn’t seem to work for me. Is Swift one of the included languages? It seems to be in the stable channel for Highlight.js.
Yes, you can add/remove languages from the highlighted languages site setting. Swift is not enabled by default and likely not enabled on your site, which is probably why
```swift
is not working for you. (Swift is also not enabled on meta.) It does work for me locally when I add Swift to the site setting:
Found the issue. I had to add Swift as a supported language in the site settings. I also removed a bunch of languages that my community doesn’t use. It’s fixed the issue.