minted-quarto

0
2 месяца назад
2 месяца назад
2 года назад
2 года назад
2 года назад
2 года назад
README.md

title: "Minted-quarto Example" filters:

  • minted-quarto format: pdf: default keep-tex: true pdf-engine-opts:
  • -shell-escape include-before-body:
  • text: | \usemintedstyle{bw} minted: include_listings: true level_option: section inline_code: true options: cachedir: _minted-cache

Use .qmd as an example

This filter adds minted and listings environments to Quarto. It is based on the minted package for LaTeX. The minted package uses the Python Pygments library to highlight code. Since the minted package is not included in the default LaTeX distribution, you will need to install it separately. Please refer to the minted documentation for installation instructions.

print("hello")

To use the minted-quarto filter to compile into PDF, include the following in the

YAML
front matter:

#| eval: false pdf-engine-opts: - -shell-escape

You can specify whether you want to transform inline code blocks into minted environments; by default, this is set to true.

You can also pass any options to the minted package. Although this feature might not be useful in most cases, it can be handy in specific situations. I recommend using this filter in workflows where you have Quarto render LaTeX that you will later edit further.

Additionally, you can specify the level at which to create listing environments. By default, this is set to "chapter," but it can be changed to "section." Refer to the minted documentation for more information.

Code block level options are not supported.

To set the style, refer to the documentation and include the declaration as follows:

Unfortunately, include-in-header places it before minted is loaded, so we have to do it this way :(

#| eval: false include-in-header: - text: | \usemintedstyle{name}