Skip to content

A quarto filter to annotate code blocks with the language name

License

Notifications You must be signed in to change notification settings

JoFrhwld/codeblocklabel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codeblocklabel Extension For Quarto

This will annotate codeblocks with the language of the codeblock. Potentially useful for documents with multiple languages in use.

example

Note: The filename code chunk option won't work with this filter enabled.

Limitations: Only implemented for html output.

Installing

quarto add jofrhwld/codeblocklabel

This will install the extension under the _extensions subdirectory. If you're using version control, you will want to check in this directory.

Using

Simply add the following to your document header.

filters:
  - codeblocklabel

This will work for both executed code blocks as well as non-executed codeblocks.

Styling the labels

To add your own styling to the language name labels, target the langname class.

.langname {
    color: red;
}

Example

Here is the source code for a minimal example: example.qmd.

About

A quarto filter to annotate code blocks with the language name

Topics

Resources

License

Stars

Watchers

Forks