Skip to contents

Generate a Markdown header (levels 1-7) in any R Markdown code block. When calling inside an asis chunk, set asis = TRUE.

Usage

markdownHeader(text, level = 2L, tabset = FALSE, asis = FALSE)

Arguments

text

character(1). Text.

level

integer(1). Markdown header level (1-7).

tabset

logical(1). Include tabset marker.

asis

logical(1). Set this to TRUE when using the function inside a loop or inside an R Markdown chunk with 'results = "asis"' enabled.

Value

Note

Updated 2023-08-11.

See also

Examples

markdownHeader("Header", level = 2L)
#> [1] "## Header\n"
#> attr(,"format")
#> [1] "markdown"
#> attr(,"class")
#> [1] "knit_asis"
#> attr(,"knit_cacheable")
#> [1] NA
markdownHeader("Header", tabset = TRUE)
#> [1] "## Header {.tabset}\n"
#> attr(,"format")
#> [1] "markdown"
#> attr(,"class")
#> [1] "knit_asis"
#> attr(,"knit_cacheable")
#> [1] NA
markdownHeader("Header", asis = TRUE)
#> 
#> 
#> ## Header
#>