# Discourse syntax highlighting?

**URL:** <https://discourse.julialang.org/t/discourse-syntax-highlighting/128013>\
**Category:** Meta Discussion\
**Created:** [April 12, 2025, 9:47pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013 "2025-04-12T21:47:18Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [April 12, 2025, 9:47pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/1 "2025-04-12T21:47:18Z")

</div>

Surely it’s not just me… Does anyone else feel that the syntax highlighting for Julia on Discourse looks a bit dull compared to other languages?

For instance, here’s some simple Julia code:

```julia
struct Vec{T<:Real}
    x::T # foo
    y::T # bar
end

Base.:+(a::Vec, b::Vec) = Vec(a.x + b.x, a.y + b.y)

α = 1.23
v = Vec(1.0, α) + Vec(3.0, 4.0)

mode = :fast

if mode == :fast
    @info v
end

```

> **\[Here's a screenshot of this on my machine.\]**
>
> ![image](https://global.discourse-cdn.com/julialang/original/3X/7/3/73c8e0861b6c1b717526f2d430fa57b908bf2b12.png)

And now a similar snippet translated to JavaScript:

```javascript
class Vec {
    constructor(x, y) {
        this.x = x; // foo
        this.y = y; // bar
    }

    add(other) {
        return new Vec(this.x + other.x, this.y + other.y);
    }
}

const α = 1.23;
const v = new Vec(1.0, α).add(new Vec(3.0, 4.0));

const mode = "fast";

if (mode === "fast") {
    console.log(v);
}

```

> **\[Here's a screenshot of this on my machine.\]**
>
> ![image](https://global.discourse-cdn.com/julialang/original/3X/c/0/c0e9f6ae2e24c6c21b09a11c9d0ad8c23be34e6d.png)

Maybe it’s a small thing, but given how much the Julia community relies on Discourse, it seems odd that Julia’s syntax highlighting feels noticeably less clear or vibrant than other languages on the Julia forum itself. Is there any way to improve it? How configurable is Discourse?

OhMyREPL highlighting in my terminal, for reference:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/6/86565ddbf401e34e76205faa94e51bf9f61392a0.png)

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [April 12, 2025, 9:48pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/2 "2025-04-12T21:48:28Z")

</div>

> [@MilesCranmer](#):
>
> Surely it’s not just me…

> [@Does everyone's code highlight on Discourse look so bland?](https://discourse.julialang.org/t/does-everyones-code-highlight-on-discourse-look-so-bland/93803):
>
> This is how all code here looks like for me: The if, else, etc. are bolded, once in a while some words are in blue or red. I find it really hard sometimes to parse quickly what am I looking at. Discourse is said to have highltight.js support and on its website there is a variety of options. Is there a setting somewhere that I missed? Or is this just how code looks on Julia Discourse?

---

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [April 12, 2025, 9:52pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/3 "2025-04-12T21:52:42Z")

</div>

Thanks. Will post here to not ping everybody on that thread

> [@Does everyone's code highlight on Discourse look so bland?](https://discourse.julialang.org/t/does-everyones-code-highlight-on-discourse-look-so-bland/93803/13):
>
> To my knowledge, Fredrik’s branch has not (yet) been upstreamed into highlights.js. It’d be great if it could! Just to be clear, the things we have control over on Discourse are: The default highlighting language — this is set to julia The enabled highlighting languages — this is set to 33 languages and we can add more if you find it’d be helpful. play_button List of currently enabled languages I think the themes’ CSS should be able to override the default styling of the identifiers. This does…

@mbauman do you know if there are any updates to what things we have control over on Discourse? I feel like Discourse is popular enough for someone somewhere to figure out how to customize code highlighting CSS for a specific community

---

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [April 12, 2025, 9:57pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/4 "2025-04-12T21:57:25Z")

</div>

@mbauman check out this:

> **[Codeblock Theme Picker](https://meta.discourse.org/t/codeblock-theme-picker/146396)**
>
> :discourse2: Summary Codeblock Theme Picker will allow you to easily change the theme used in code blocks. 👓 Preview Preview on Discourse Theme Creator 🛠 Repository Link https://github.com/discourse/hljs-theme-picker 📖 New to Discourse...

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/6/868a7d7ed78fb88a92393fe4fcdea72b01d7cd5e.jpeg)

---

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [April 12, 2025, 9:58pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/5 "2025-04-12T21:58:36Z")

</div>

@fredrikekre @mbauman

Also looks like there’s a way to override highlight.js here:

> **[Install a new language for Highlight.JS via a theme component](https://meta.discourse.org/t/install-a-new-language-for-highlight-js-via-a-theme-component/292480)**
>
> I’ve just added a hook to our HighlightJS code so now you can use the plugin API to add a custom language for Highlight.JS. Example (using the beancount language definition): const beancountLang = function(e){var...

---

<div class="post-metadata">

**Author:** ![liuyxpp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/liuyxpp/32/9870_2.png) [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Post date:** [April 13, 2025, 1:19am UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/6 "2025-04-13T01:19:33Z")

</div>

I am glad someone finally points out the issue here. Thanks @MilesCranmer for putting your efforts into this issue.

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [April 13, 2025, 9:55am UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/7 "2025-04-13T09:55:50Z")

</div>

I prefer “dull” to “so flashy as to hinder readability”. Definitely prefer the way Julia code is highlighted to your JavaScript example, the latter is much less readable to me.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [April 13, 2025, 10:16am UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/8 "2025-04-13T10:16:21Z")

</div>

It’s definitely too dull now, imo. I especially dislike that it only seems to highlight some predefined list of types, e.g.

```julia
foo(x::Real)
foo(x::Vec)

```

And _zero_ highlighting here?

```julia
Base.:+(a::Vec, b::Vec) = Vec(a.x + b.x, a.y + b.y)

```

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [April 13, 2025, 10:39am UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/9 "2025-04-13T10:39:57Z")

</div>

> [@DNF](#):
>
> I especially dislike that it only seems to highlight some predefined list of types

Agree, special-casing is ugly. However, given that types are normal values in Julia, I think the only choice is not to attempt to treat types differently than other kinds of values.

---

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [April 13, 2025, 11:12am UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/10 "2025-04-13T11:12:26Z")

</div>

We could do a poll

Is the syntax highlighting of Julia:

_Poll ([view on site](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/10))_

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [April 13, 2025, 4:46pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/11 "2025-04-13T16:46:03Z")

</div>

> [@nsajko](#):
>
> However, given that types are normal values in Julia, I think the only choice is not to attempt to treat types differently than other kinds of values.

The right side of the `::` operator generally needs to be a `Type`:

```julia
julia> 1::1
ERROR: TypeError: in typeassert, expected Type, got a value of type Int64

julia> foo(x::1) = 42
ERROR: ArgumentError: invalid type for argument x in method definition for foo at REPL[6]:1

```

So it’s reasonable to use a “type scope” to highlight the RHS of `::`, which is what the Julia extenstion in VS Code does:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/1/41863c55349c51919a0df30a621fec521fda2604.png)

EDIT:

Though I see that it doesn’t work quite as well as one might like. Not sure if this is fixable:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/7/1789bb130ade0d479957aeb52ab6c11aa961a646.png)

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/e/1edd3606db3f4aa5b0ac4a060d21b4b71d433a1a.png)

Here you can see that `typeof` is assigned the `support.type.julia` TextMate scope, which is not quite right.

You’re probably right that, strictly speaking, any expression can be used on the right-hand side of `::`, so we shouldn’t really color those expressions differently, but practically speaking it is pretty nice to give the RHS (which is usually a type) a different color.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [April 14, 2025, 4:43pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/12 "2025-04-14T16:43:07Z")

</div>

I’m always game to try stuff out. We are a CDCK-hosted discourse here, so we are more constrained than a typical self-hosted install. However, we can edit themes and theme components. I had been thinking that we were limited to just css styling with the default hljs tagging, but to change anything meaningful, we need a new hljs javascript spec.

Best of all worlds (and simplest!) would be to upstream Fredrik’s work from [Improved syntax highlighting for Julia on the web | Fredrik Ekre](https://fredrikekre.se/posts/highlight-julia/). It looks like that had been blocked on Safari (ok since 27 March 2023) and then [v12 of hljs](https://github.com/highlightjs/highlight.js/issues/2832#issuecomment-2084332875) (still at v12.0.0-pre right now).

It does look like we can add custom language support via custom JS in a theme or theme component. I’m not clear if that means we can also _override_ Julia’s default hljs highlighting, but I’d guess we could. I don’t know how though. To be concrete, I’d need to know what gets plopped here:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/9/892eab5ec64d9a9cc0ecab21e948fcf90ffe20f6.png)

---

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [April 14, 2025, 4:56pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/13 "2025-04-14T16:56:14Z")

</div>

Can you turn off languages? My guess is that you would disable Julia, and then add a “custom language” which is just Julia but with the improved syntax highlighting.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [April 14, 2025, 5:01pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/14 "2025-04-14T17:01:25Z")

</div>

Yes, but again, I don’t know the order of effects here:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/6/6683e4ad4b31c4178b97830be9704cc74f055006.png)

---

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [April 14, 2025, 5:12pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/15 "2025-04-14T17:12:12Z")

</div>

Is there a `/admin/customize/themes` page? That should let you create a theme. Then you should be able to preview it while editing.

Also is there a `/admin/customize/themes/components` page?

---

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [April 14, 2025, 5:15pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/16 "2025-04-14T17:15:11Z")

</div>

I think it should basically look like this though:

1. Delete `julia` and `julia-repl` from the list of highlighted languages in your screenshot.
2. Insert the following code from this how-to guide [Install a new language for Highlight.JS via a theme component - Developer Guides - Discourse Meta](https://meta.discourse.org/t/install-a-new-language-for-highlight-js-via-a-theme-component/292480)

```js
import { apiInitializer } from "discourse/lib/api";

export default apiInitializer((api) => {
    const juliaLang = function(e){
        // Fredrik's code
    }
    api.registerHighlightJSLanguage("julia", juliaLang);
    api.registerHighlightJSLanguage("julia-repl", juliaLang);
    // Or if there's a custom REPL highlighter, use that?
});

```

---

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [April 14, 2025, 5:26pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/18 "2025-04-14T17:26:49Z")

</div>

Seems the same as what glimmer.js does: [discourse-highlightjs-glimmer/javascripts/discourse/api-initializers/init-highlightjs-glimmer.js at main · discourse/discourse-highlightjs-glimmer · GitHub](https://github.com/discourse/discourse-highlightjs-glimmer/blob/main/javascripts/discourse/api-initializers/init-highlightjs-glimmer.js)

```js
import { apiInitializer } from "discourse/lib/api";
import { glimmer, glimmerJavascript } from "../../vendor/highlightjs-glimmer";

export default apiInitializer("0.8", (api) => {
  api.registerHighlightJSLanguage("glimmer", glimmer);
  api.registerHighlightJSLanguage("glimmer-javascript", glimmerJavascript);
});

```

where the `highlightjs-glimmer` file is here: [discourse-highlightjs-glimmer/javascripts/vendor/highlightjs-glimmer/index.js at main · discourse/discourse-highlightjs-glimmer · GitHub](https://github.com/discourse/discourse-highlightjs-glimmer/blob/main/javascripts/vendor/highlightjs-glimmer/index.js)

> **Formatted version to save your eyes:**
>
> ```js
> function o(n) {
> function t() {
> return {
> name: 'Ember.JS, Glimmer',
> aliases:
> ['glimmer', 'hbs', 'html.hbs', 'html.handlebars', 'htmlbars'],
> case_insensitive: !0, keywords: E, disableAutodetect: !0, contains: [
> n.COMMENT(/\{\{!--/, /--\}\}/), n.COMMENT(/\{\{!/, /\}\}/),
> n.COMMENT(/<!--/, /-->/), d, ...l, g, u, S, ...H
> ]
> }
> }
> let E = {
> $pattern: /\b[\w][\w-]+\b/,
> keyword: ''.concat('outlet yield', ' ')
> .concat('action on', ' ')
> .concat('log debugger'),
> built_in: 'let each each-in if else unless',
> function:
> ''.concat('not-eq xor is-array is-object is-equal', ' ')
> .concat(
> 'has-block concat fn component helper modifier get hash query-params',
> ' ')
> .concat('eq neq', ' ')
> .concat('gt gte le lte', ' ')
> .concat('and or not'),
> literal: 'true false undefined null'
> },
> f = e.either(
> e.concat(/[a-zA-Z_]/, e.optional(/[A-Z0-9:_.-]*:/), /[A-Z0-9_.-]*/),
> /[a-z]/),
> _ = /[A-Z][A-Za-z0-9]+/,
> I = e.either(
> _, /[a-zA-Z0-9]*\.[a-zA-Z0-9-]*/, e.concat(_, /::/, /-?/, _),
> /[a-z]/),
> P = /[a-z-][a-z\d-_]+\b/, C = /[@A-Za-z0-9._:-]+/,
> d = {className: 'symbol', begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},
> G = {
> className: 'punctuation',
> match: e.either(
> /\./, /\{\{\{?#?\/?/, /\}\}\}?/, /\(/, /\)/, /::/, /\|/, /~/)
> },
> L = {
> begin: /as\s+\|/,
> keywords: {keyword: 'as'},
> end: /\|/,
> contains: [{className: 'template-variable', begin: C}]
> },
> g = {className: 'operator', match: /=/}, u = {
> className: {1: 'punctuation', 2: 'params'},
> match: [/@/, /[\w\d-_]+/]
> },
> N = {
> className: {1: 'attribute', 2: 'operator'},
> match: [/[A-Za-z0-9-_]+/, /=/]
> },
> R = {
> className: {1: 'class', 2: 'punctuation', 3: 'property'},
> match: [/this/, /\./, /[^\s}]+/]
> },
> A = {className: 'title', match: I},
> U = {className: 'title', match: P, keywords: E},
> x = {className: 'number', match: /[\d]+((\.[\d]+))?/}, S = {
> className: 'comment',
> begin: /\{\{!--/,
> contains: [
> {className: 'comment', match: /.+/}, {begin: /--\}\}/, endsParent: !0}
> ]
> },
> m = {
> className: 'string',
> variants: [
> {begin: /"/, end: /"/, contains: [d]},
> {begin: /'/, end: /'/, contains: [d]}
> ]
> },
> p = [G, g, u, x, L, R, N, U, m], O = {
> keywords: E,
> begin: e.concat(/\(/, e.lookahead(e.concat(/\)/))),
> end: /\)/,
> contains: [...p, 'self', {begin: /\)/, endsParent: !0}]
> };
> p.push(O);
> let l = [{
> className: 'punctuation mustache',
> keywords: E,
> begin: e.concat(/\{\{\{?#?/),
> end: /\}\}\}?/,
> contains: [{begin: /\}\}\}?/, endsParent: !0}, ...p, O]
> }];
> m.variants.forEach(v => v.contains.push(...l));
> let H = [
> {
> className: 'tag',
> begin: e.concat(
> /<:?/, e.lookahead(e.concat('style', e.either(/\/>/, />/, /\s/)))),
> end: /\/?>/,
> contains: [g, u, S, L, R, ...l, N, m, A],
> starts: {
> className: 'tag',
> end: /<\/style>/,
> returnEnd: !0,
> excludeEnd: !1,
> subLanguage: ['css', 'glimmer']
> }
> },
> {
> className: 'tag',
> begin:
> e.concat(/<:?/, e.lookahead(e.concat(f, e.either(/\/>/, />/, /\s/)))),
> end: /\/?>/,
> contains: [g, u, S, L, R, ...l, N, m, A]
> },
> {
> className: 'tag',
> begin: e.concat(/<\/:?/, e.lookahead(e.concat(f, />/))),
> end: />/,
> contains: [A]
> }
> ];
> return t()
> }
> function y(n) {
> return T('(?=', n, ')')
> }
> function w(n) {
> return T('(', n, ')?')
> }
> function T(...n) {
> return n.map(a => M(a)).join('')
> }
> function j(...n) {
> return '(' + n.map(a => M(a)).join('|') + ')'
> }
> function M(n) {
> return n ? typeof n == 'string' ? n : n.source : null
> }
> var e = {lookahead: y, either: j, optional: w, concat: T};
> var k = ['css`', '.?css`'];
> function B(n, t) {
> let s = t.rawDefinition(n).contains.find(
> c => k.includes(c == null ? void 0 : c.begin)),
> i = n.inherit(s, {begin: /hbs`/});
> return i.starts.subLanguage = 'glimmer', i
> }
> var r = {
> begin: /<template>/,
> end: /<\/template>/,
> isTrulyOpeningTag: (n, t) => {
> let a = n[0].length + n.index, s = n.input[a];
> if (s === '<' || s === ',') {
> t.ignoreMatch();
> return
> }
> let i;
> if ((i = n.input.substring(a).match(/^\s+extends\s+/)) && i.index === 0) {
> t.ignoreMatch();
> return
> }
> }
> },
> z = {
> variants: [{begin: r.begin, 'on:begin': r.isTrulyOpeningTag, end: r.end}],
> subLanguage: 'glimmer',
> contains: [{begin: r.begin, end: r.end, skip: !0, contains: ['self']}]
> };
> function b(n, t = 'javascript') {
> let a = n.getLanguage(t);
> if (!a) {
> console.warn(
> 'JavaScript grammar not loaded. Cannot initialize glimmerJavascript.');
> return
> }
> return {
> name: 'glimmer-javascript', aliases: ['glimmer-js', 'gjs'], subLanguage: t,
> contains: [z, B(n, a)]
> }
> }
> var tn = o, J = b;
> function an(n) {
> Z(n), h(n)
> }
> function sn(n) {
> let t = o(n);
> return h(n), t
> }
> function Z(n) {
> return n.registerLanguage('glimmer', o)
> }
> function h(n) {
> $(n)
> }
> function $(n) {
> let t = '_js-in-gjs', a = n.getLanguage('javascript');
> n.registerLanguage(t, s => a.rawDefinition(s)),
> n.unregisterLanguage('javascript'),
> n.registerLanguage('glimmer-javascript', s => {
> let i = J(s, t);
> return i.aliases.push('javascript', 'js', 'mjs', 'cjs', 'mjs'), i
> })
> }
> export {
> sn as externalSetup,
> tn as glimmer,
> J as glimmerJavascript,
> h as registerInjections,
> Z as registerLanguage,
> an as setup
> };
> 
> ```

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [April 14, 2025, 5:42pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/19 "2025-04-14T17:42:04Z")

</div>

Clear your cache and try again. I believe it should be enabled for all themes.

---

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [April 14, 2025, 5:45pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/20 "2025-04-14T17:45:14Z")

</div>

Amazing!! Thanks so much for getting this through!

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [April 14, 2025, 5:51pm UTC](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013/21 "2025-04-14T17:51:24Z")

</div>

It does look like this changed a few CSS names here, I think. In particular the REPL’s prompt… and it’s always been strange that macros are styled the same as comments. But I think this is better:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/5/65afa3bc77a1eff4ee5cec7107dc845275f952a8.png)

> **the code for the above**
>
> ```julia
> struct Vec{T<:Real}
> x::T # foo
> y::T # bar
> end
> 
> Base.:+(a::Vec, b::Vec) = Vec(a.x + b.x, a.y + b.y)
> 
> α = 1.23
> v = Vec(1.0, α) + Vec(3.0, 4.0)
> 
> mode = :fast
> 
> if mode == :fast
> @info v
> end
> 
> ```
> 
> ```julia-repl
> julia> struct Vec{T<:Real}
> x::T # foo
> y::T # bar
> end
> 
> julia> Base.:+(a::Vec, b::Vec) = Vec(a.x + b.x, a.y + b.y)
> 
> julia> α = 1.23
> 1.23
> 
> julia> v = Vec(1.0, α) + Vec(3.0, 4.0)
> Vec{Float64}(4.0, 5.23)
> 
> julia> mode = :fast
> :fast
> 
> julia> if mode == :fast
> @info v
> end
> [ Info: Vec{Float64}(4.0, 5.23)
> 
> ```

[Next page](https://discourse.julialang.org/t/discourse-syntax-highlighting/128013.md?page=2)
