I'm writing a brief Quarto document where I explain some SQL clauses/keywords. I'd like to have all of those clauses to be highlighted in my code chunks, but not all of them are supported by default syntax highlighting. Is there a way to add custom keywords to syntax highlighting settings?
For example, I wrote the following code chunks:
SELECT col_name(s)
FROM tbl_name
LIMIT n OFFSET m
-- Syntax supported by MySQL, MariaDB, PostgreSQL, SQLite
-- LIMIT = number of rows to retrieve
-- OFFSET = starting row (optional)
SELECT TOP n col_name(s)
FROM tbl_name
-- Syntax supported by SQL Server and MS Access
And i got the following outputs in my rendered document:
I want both OFFSET
and TOP
to be highlighted in orange, like SELECT
, FROM
etc. How can I do that?
CodePudding user response:
There are several SQL highlight variants, you can get a list of those with quarto pandoc --list-highlight-languages
and switching from sql
to sqlpostgresql
will get you highlighted OFFSET
.
It's surprisingly easy to customize any of the existing highlights,