This is a Quarto extension that allows to highlight text in a document for various format: HTML, LaTeX, Typst, and Docx.
quarto add mcanouil/quarto-highlight-text
This will install the extension under the _extensions
subdirectory.
If you're using version control, you will want to check in this directory.
To use the extension, add the following to your document's front matter:
filters:
- highlight-text
Then you can use the span syntax markup to highlight text in your document, e.g.:
[Red]{colour="#b22222" bg-colour="#abc123"} # UK
[Blue]{color="#0000FF" bg-color="#ABC123"} # US
You can also use the shorter syntax (v1.1.1):
[Red]{fg="red" bg="primary"}
Using colours from _brand.yml
(v1.1.0):
brand:
color:
palette:
red: "#b22222"
primary: "#abc123"
[Red]{colour="brand-color.red" bg-colour="brand-color.primary"}
Here is the source code for a minimal example: example.qmd
.
Outputs of example.qmd
:
- HTML
- Typst/PDF
- LaTeX/PDF
- Word/Docx (only supports plain text, i.e., no URLs)
- Reveal.js
- Beamer/PDF
- PowerPoint/Pptx (only supports plain text, i.e., no URLs)