mkgallery shortcode for Quarto

mkgallery, a quarto shortcode extension, makes easy to put images in the specified directory on the document.
Published

October 16, 2024

Note

mkgallery only available when rendering HTML document. For other rendering format, it will just list up the images.

Instalation

To use the mkgallery extension in your Quarto project, follow these steps:

  1. Run the following command in your terminal within the project’s working directory. This will install the extension under the _extensions subdirectory:
quarto add t-arae/mkgallery
  1. Once installed, apply the mkgallery filter by adding the following lines to the YAML header of your .qmd file:
filters:
  - t-arae/mkgallery

Using the shortcode

To display images from the articles/imgs/ directory in your Quarto document using the mkgallery shortcode, use the following syntax:

{{< mkgallery articles/imgs >}}

This will embed all images from the articles/imgs/ directory onto your document.

beko.jpeg
beko.jpeg
beko.png
beko.png
beko_blur.png
beko_blur.png
beko_gray.png
beko_gray.png
beko_half.jpg
beko_half.jpg
beko_noise.png
beko_noise.png
beko_one_fourth.jpg
beko_one_fourth.jpg

Example

You can find the source code for several examples of the mkgallery shortcode usage at the following link: example.qmd.

To see the rendered version of this example, visit the following link: here.

Version info

The version of Quarto built-in Pandoc and Lua:

quarto pandoc --version 2>&1 | head -3
pandoc 3.2
Features: +server +lua
Scripting engine: Lua 5.4