mean(1:5)
[1] 3
To install this extension in your current directory (or into the Quarto project that you’re currently working in), use the following terminal command:
This will install the extension in the _extensions
subdirectory. If you’re using version control, you will want to check in this directory.
Enable the filter by including it in the YAML front matter:
By default, the language name will be added to all language-specific blocks in the document. You can disable this with the show-all
option in the YAML front matter:
You can also enable or disable language names on a block-by-block basis with the show-language
attribute, which can be either true
or false
. For instance:
By default, the language will be converted to sentence case (i.e. first letter capitalized). This works for many languages, like R and Python. For example, this Python chunk renders with a title of “Python”:
For languages like YAML, though, the name will render as “Yaml”:
You can control the text for the language name with the language-title
option:
You can use whatever you want in the language-title
option, like adding emojis or extra language details:
Here are some other examples:
This also works with computational cells:
You can control options within computational cells as well using inline attributes. Here’s a custom language name:
And here’s a chunk with no language name:
It also works when using the filename
attribute:
The color of the language title and little border line should automatically adapt to whatever highlighting color scheme you’re using. It’s set to be at 80% opacity of the CSS variable --quarto-hl-co-color
, which is used for code comments and code annotations and the copy button in code output.
Try toggling from dark to light mode to check: Switch between light/dark mode
If you want to define your own colors, you can either (1) edit language-name.css
in the extension folder directly or (2) you can add your own custom CSS in a separate file or injected through the include-in-header
option in the YAML front matter.
The relevant CSS settings are at the end:
So you could, for instance, do this in a document: