Syntax highlighting

Could this site highlight the syntax of (a) YAML (a superset of JSON) and/or (b) Cabal files? It currently handles Haskell source code (with ~~~haskell) and JSON (with ~~~json).

In the case of Cabal file syntax, I appreciate that highlighter.js does not handle it out of the box, but perhaps something can be borrowed from the implementation of the Haskell Syntax Highlighting extension for VS Code (which handles Cabal files).

For example, currently, (using ~~~yaml):

# package.yaml
spec-version:        0.36.0
name:                my-package
version:             0.1.0.0

dependencies:
- base >= 4.7 && < 5

library:
  source-dirs: src

Or (using, say, ~~~cabal):

-- my-package.cabal
cabal-version:  1.12
name:           my-package
version:        0.1.0.0

library
  exposed-modules:
      Lib
  hs-source-dirs:
      src
  build-depends:
      base >=4.7 && <5

YAML is used to configure GHCup and Stack, describe packages (with Hpack), and widely in the CI of Haskell projects.

11 Likes

This could be done via theme components.