Nix code Highlighting

Just enabled the code highlighting for Nix source :slight_smile:

{ stdenv, fetchurl }:
stdenv.mkDerivation rec {
  name = "foo-${version}";
  version = "1.2.3";
  src = fetchurl {
    url = "https://dl.foo.com/foo-${version}.tar.gz";
    sha256 = "...";
  };
}

PS: Discourse is using hightlight.js for the code highlighting.

https://meta.discourse.org/t/adding-additional-languages-to-highlight-js-used-by-discourse/22925/5

2 Likes

As a note, the syntax highlighting doesn’t appear in emails. Not sure if there is anything we can do about this from our end?

Highlight.js leaves the syntax tokenizing to the JavaScript so nothing is happening server side. I don’t think that there is an easy fix for that.