PSA: Formatting REPL snippets on Stack Overflow

Stack Overflow recently changed their syntax highlighter from Google Prettify to highlight.js:

I’ve noticed that now snippets of code from the Julia REPL often get highlighted funny, like this:

Here you can see that almost everything is green, except for some of the numbers which are orange/brown. (However, note that normal code chunks that are not entered at the julia> prompt are highlighted reasonably well.)

There’s an easy fix for this problem. After the initial three backticks for a code block with a REPL snippet, use the language tag lang-none, like this:

    ```lang-none
        julia> 1 + 1
        2
    ```
4 Likes