quarto.doc

add_format_resource

function quarto.doc.add_format_resource(file: string)

Add a format resource to the document. The path to the file should relative to the Lua script calling this function.

Format resources will be copied into the directory next to the rendered file. This is useful, for example, if your format references a bst or cls file which must be copied into the LaTeX output directory.

add_html_dependency

function quarto.doc.add_html_dependency(dependency: table)

Add an HTML dependency (additional resources and content) to a document.

HTML Dependencies can bundle together JavaScript, CSS, and even arbitrary content to inject into the <head> of the document. These dependencies have a name and a version, which is used to ensure that the same dependency isn’t bundled into the document more than once.

See the documentation on HTML Dependencies in Quarto Extensions for additional details.

attach_to_dependency

function quarto.doc.attach_to_dependency(name: string, file: string|{ path: string, name: string })

Include a file within the output directory for an HTML dependency

cite_method

function quarto.doc.cite_method()
  -> 'biblatex'|'citeproc'|'natbib'

Cite method (citeproc, natbib, or biblatex) for the current render

return #1:
    | 'citeproc'
    | 'natbib'
    | 'biblatex'

has_bootstrap

function quarto.doc.has_bootstrap()
  -> boolean

Does the current output format include Bootstrap themed HTML

include_file

function quarto.doc.include_file(location: 'after-body'|'before-body'|'in-header', file: string)

Include file at the specified location (in-header, before-body, or after-body).

The path to the file should relative to the Lua script calling this function.

location:
    | 'in-header'
    | 'before-body'
    | 'after-body'

include_text

function quarto.doc.include_text(location: 'after-body'|'before-body'|'in-header', text: string)

Include text at the specified location (in-header, before-body, or after-body).

location:
    | 'in-header'
    | 'before-body'
    | 'after-body'

input_file

string

Full path to input file for the current render

is_format

function quarto.doc.is_format(name: string)
  -> boolean

Detect if the current format matches name

The name parameter can match an exact Pandoc format name (e.g. docx, latex, etc. or can match based on an alias that groups commonly targeted formats together. Aliases include:

  • latex: latex, pdf
  • pdf: latex, pdf
  • epub: epub*
  • html: html*, epub*, revealjs
  • html:js: html*, revealjs
  • markdown: markdown*, commonmark*, gfm, markua

Note that the html:js alias indicates that the target format is capable of executing JavaScript (this maps to all HTML formats save for ePub).

output_file

string

Full path to output file for the current render

pdf_engine

function quarto.doc.pdf_engine()
  -> string

PDF engine (e.g. pdflatex) for the current render

project_output_file

function quarto.doc.project_output_file()
  -> string|nil

Provides the project relative path to the current input if this render is in the context of a project (otherwise nil)

use_latex_package

function quarto.doc.use_latex_package(package: string, options?: string)

Adds a \usepackage statement to the LaTeX output

If appropriate, include package options using the options parameter.