Skip to content

Commit 25c3bce

Browse files
committed
knitr: allow for figure caption/subcaption even with no label
1 parent 221dd4c commit 25c3bce

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/resources/rmd/hooks.R

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,10 @@ knitr_hooks <- function(format, resourceDir, handledLanguages) {
184184
}
185185
}
186186

187-
# determine label and caption output
188-
label <- paste0(labelId(label), " ")
189-
if (is_figure_label(label)) {
190-
if (!is.null(fig.cap) && !is.null(fig.subcap)) {
191-
cell.cap <- paste0("\n", fig.cap, "\n")
192-
} else {
193-
label = NULL
194-
}
195-
} else {
187+
# caption output
188+
if (!is.null(fig.cap) && !is.null(fig.subcap)) {
189+
cell.cap <- paste0("\n", fig.cap, "\n")
190+
} else {
196191
label <- NULL
197192
}
198193

0 commit comments

Comments
 (0)