Skip to content

Commit 7bb1080

Browse files
committed
fix: only add title to blocks if title exists
1 parent 1adc0bf commit 7bb1080

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

R/Reporter.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,12 @@ Reporter <- R6::R6Class( # nolint: object_name_linter.
212212
if (idx != length(cards)) blocks <- append(blocks, sep)
213213
next # Easier to remove when ReportCard is fully deprecated
214214
}
215-
card_with_title <- c(report_document(sprintf("# %s", metadata(card, "title"))), card)
215+
card_with_title <- if (length(metadata(card, "title")) > 0) {
216+
c(report_document(sprintf("# %s", metadata(card, "title"))), card)
217+
} else {
218+
card
219+
}
220+
216221
blocks <- append(blocks, unclass(card_with_title))
217222
if (idx != length(cards)) blocks <- append(blocks, trimws(sep))
218223
}

0 commit comments

Comments
 (0)