Skip to contents

This method allows to easily register the parse-acronyms Lua filter in a RMarkdown document. This filter is ultimately responsible for every functionality of this package: loading the list of acronyms, creating the glossary in the document, and linking acronyms to their definition.

Usage

add_filter(error = TRUE)

Arguments

error

Whether to raise an error if the required version of pandoc is not found

Value

A string representing the pandoc argument that loads the Lua filter. The string will have the following format: '--lua-filter=/path/to/parse-acronyms.lua'.

Details

The main purpose of this function is to be used inside the YAML metadata of a RMarkdown document.

Specifically, it should be added in the output.<format name>.pandoc_args field, where <format name> is the name of your desired output format, e.g., pdf_document, bookdown::html_book, etc.

If several output formats are used, pandoc_args should be duplicated for each of the formats.

This method is largely inspired from rmdfiltr

Examples

pandoc_args support several syntaxes, which are shown below. Since add_filter returns a single string, it can be combined with other arguments.

Note that !expr must be used to execute the function and insert its result in the YAML.

To simply use add_filter as the sole argument:


---
output:
  html_document:
    pandoc_args: !expr acronymsdown::add_filter()
---

To allow using other arguments:


---
output:
  html_document:
    pandoc_args:
      - !expr acronymsdown::add_filter()
      - additional arguments here ...
---

With several output formats:


---
output:
  html_document:
    pandoc_args:
      - !expr acronymsdown::add_filter()
  bookdown::pdf_book:
    pandoc_args:
      - !expr acronymsdown::add_filter()
---