# Improved syntax highlighting for Julia on the web

**URL:** <https://discourse.julialang.org/t/improved-syntax-highlighting-for-julia-on-the-web/49149>\
**Category:** Community\
**Tags:** blog, blog-post\
**Created:** [October 27, 2020, 9:13pm UTC](https://discourse.julialang.org/t/improved-syntax-highlighting-for-julia-on-the-web/49149 "2020-10-27T21:13:02Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [November 6, 2020, 1:06pm UTC](https://discourse.julialang.org/t/improved-syntax-highlighting-for-julia-on-the-web/49149/21 "2020-11-06T13:06:52Z")

</div>

> Now, I found some lexing errors, where should I send the feedbacks?

My fork maybe? [Issues · fredrikekre/highlight.js · GitHub](https://github.com/fredrikekre/highlight.js/issues)

---

<div class="post-metadata">

**Author:** ![singularitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singularitti/32/17678_2.png) [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Post date:** [November 9, 2020, 7:59am UTC](https://discourse.julialang.org/t/improved-syntax-highlighting-for-julia-on-the-web/49149/22 "2020-11-09T07:59:22Z")

</div>

Is it me or recently the GitHub’s rendering of code is not right?

1. 

2. 

3.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [November 9, 2020, 9:00am UTC](https://discourse.julialang.org/t/improved-syntax-highlighting-for-julia-on-the-web/49149/23 "2020-11-09T09:00:40Z")

</div>

[Yes](https://github.com/github/linguist/issues/5087).

Update: The fix is deployed now. Repos with broken highlighting need a commit to invalidate their cache.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [January 9, 2021, 3:44am UTC](https://discourse.julialang.org/t/improved-syntax-highlighting-for-julia-on-the-web/49149/24 "2021-01-09T03:44:19Z")

</div>

the current version of highlight.js does not reproduce the visual of your blog [post](https://fredrikekre.se/posts/highlight-julia/) anymore @fredrikekre , not sure what happened.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [January 9, 2021, 10:14pm UTC](https://discourse.julialang.org/t/improved-syntax-highlighting-for-julia-on-the-web/49149/25 "2021-01-09T22:14:51Z")

</div>

Upstream highlight.js does not containt the changes (yet). I hope to do it eventually, but it is pretty easy to compile your own js file based on my branch (see links [here](https://fredrikekre.se/posts/highlight-julia/#concluding_remarks)).

---

<div class="post-metadata">

**Author:** ![jmert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jmert/32/3161_2.png) [@jmert](https://discourse.julialang.org/u/jmert)\
**Post date:** [February 19, 2021, 1:04am UTC](https://discourse.julialang.org/t/improved-syntax-highlighting-for-julia-on-the-web/49149/26 "2021-02-19T01:04:12Z")

</div>

> [@christopher-dG](#):
>
> Great work! I would love to see these changes one day added to [Chroma](https://github.com/alecthomas/chroma), which is used by Hugo. Its Julia highlighting is really underwhelming compared to this.

I too want to see Chroma updated, so I went the longer route and have made a PR to [pygments](https://github.com/pygments/pygments/pull/1715) which replicates many of the ideas shown here (since I actually do know python). Since chroma advertises an auto-convert of rules from pygments, I’m hoping to just leverage that if/when the pygments PR is merged (and then need to get hugo to use a new version of chroma…)

---

<div class="post-metadata">

**Author:** ![jmert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jmert/32/3161_2.png) [@jmert](https://discourse.julialang.org/u/jmert)\
**Post date:** [April 18, 2021, 4:24pm UTC](https://discourse.julialang.org/t/improved-syntax-highlighting-for-julia-on-the-web/49149/27 "2021-04-18T16:24:17Z")

</div>

I’ve gotten updated Julia syntax rules merged into both [pygments](https://github.com/pygments/pygments/pull/1715) and [chroma](https://github.com/alecthomas/chroma/pull/472), so presumably Hugo websites will soon have much better Julia syntax highlighting.

---

<div class="post-metadata">

**Author:** ![Wei\_Yang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wei_yang/32/23951_2.png) [@Wei\_Yang](https://discourse.julialang.org/u/Wei_Yang)\
**Post date:** [October 16, 2021, 1:13am UTC](https://discourse.julialang.org/t/improved-syntax-highlighting-for-julia-on-the-web/49149/28 "2021-10-16T01:13:53Z")

</div>

Hi all,

If I want to change the style of say, Julia comments when using `hightlight.js`, with CSS, I wonder what is the correct way to do it.

For python and javascript, the following works for me, but it doesn’t change the style for Julia comments.

`.hljs-comment, .hljs-quote { color: green !important; font-style: italic !important; }`

* * *

I also commented my question in [https://github.com/highlightjs/highlight.js/issues/2832](https://github.com/highlightjs/highlight.js/issues/2832), but realized this may be a better place to ask.

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [June 2, 2024, 3:48pm UTC](https://discourse.julialang.org/t/improved-syntax-highlighting-for-julia-on-the-web/49149/29 "2024-06-02T15:48:49Z")

</div>

did this ever worked? once it was merged. I see that currently none of the code blocks produced by documenter use these improvements.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [June 27, 2024, 8:30pm UTC](https://discourse.julialang.org/t/improved-syntax-highlighting-for-julia-on-the-web/49149/30 "2024-06-27T20:30:22Z")

</div>

> <https://meta.stackexchange.com/questions/355928/julia-syntax-highlighting/400963#400963>

[Previous page](https://discourse.julialang.org/t/improved-syntax-highlighting-for-julia-on-the-web/49149.md?page=1)
