Skip to content

Commit

Permalink
Typst & Quarto
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Nov 16, 2024
1 parent 2dcd3cb commit 9191d51
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions R/finalize_typst.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ setMethod(

# Quarto cross-references
if (isTRUE(check_dependency("knitr"))) {
quarto_caption <- isTRUE(knitr::pandoc_to("typst")) &&
isFALSE(getOption("tinytable_quarto_figure", default = FALSE))
(!is.null(knitr::opts_current$get()[["label"]]) ||
!is.null(knitr::opts_current$get()[["tbl-cap"]]))
flag_typst <- isTRUE(knitr::pandoc_to("typst"))
flag_option <- isTRUE(getOption("tinytable_quarto_figure", default = FALSE))
flag_chunk_label <- isTRUE(grepl("^tbl-", knitr::opts_current$get()[["label"]]))
flag_chunk_caption <- !is.null(knitr::opts_current$get()[["tbl-cap"]])
quarto_caption <- flag_typst && flag_option && (!flag_chunk_label || !flag_chunk_caption)
if (quarto_caption) {
out <- lines_drop_between(out,
regex_start = "// start figure preamble",
Expand Down

0 comments on commit 9191d51

Please sign in to comment.