Custom syntax highlighting in quarto doc code chunks

This page summarizes the projects mentioned and recommended in the original post on /r/RStudio

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • pandoc-goodies

    A tresure-box of resources for pandoc, pp and Texts word processor.

  • 1) Pandoc uses KDE .theme files (JSON) to map a style (color, face, ...) to the various "roles" a piece of your code can have (keyword, operator, property, ...). Check this to learn more about those theme files. You can use this boilerplate as a base to create your custom theme. Refer to this guide for more details about which keys in the .theme file correspond to which parts of the code.

  • skylighting

    A Haskell syntax highlighting library with tokenizers derived from KDE syntax highlighting descriptions

  • 2) Pandoc invokes the skylight Haskell library, which uses XML syntax descriptions to define which tokens/pieces of a given language have which "role". Skylight will parse your code and tag each part of it according to those rules. You can edit those XML files (or create new ones). Check this page for a description of how they work. You'll find the existing KDE XML syntax descriptors here.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • syntax-highlighting

    Syntax highlighting Engine for Structured Text and Code.

  • 2) Pandoc invokes the skylight Haskell library, which uses XML syntax descriptions to define which tokens/pieces of a given language have which "role". Skylight will parse your code and tag each part of it according to those rules. You can edit those XML files (or create new ones). Check this page for a description of how they work. You'll find the existing KDE XML syntax descriptors here.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts