Is there a way to configure syntax highlighting in topics?

When posting code excerpts, you can use the “Preformatted text” feature.

But depending on the length of the excerpt it’s not always trivial to read. Can you somehow annotate what kind of syntax highlighting should be used? (i.e. DAML, Java, C#, etc?)

2 Likes

You can add the language name after the triple backticks at the beginning, e.g.,

```java
public class HelloWorld {

    public static void main(String[] args) {
        // Prints "Hello, World" to the terminal window.
        System.out.println("Hello, World");
    }
}

I believe we do not yet have proper syntax highlighting for DAML code. You can find a list of the language names and aliases at https://github.com/highlightjs/highlight.js/blob/master/SUPPORTED_LANGUAGES.md

3 Likes

Correct, and there is also a way to add custom syntax.

Edit: Also we’re currently highlighting for these languages, and DAML gets the haskell highlighting.

1 Like