Generate a Markdown header (levels 1-7) in any R Markdown code block. When
calling inside an asis
chunk, set asis = TRUE
.
Arguments
- text
character(1)
. Text.- level
integer(1)
. Markdown header level (1-7).- tabset
logical(1)
. Include tabset marker.- asis
logical(1)
. Set this toTRUE
when using the function inside a loop or inside an R Markdown chunk with 'results = "asis"
' enabled.
Value
asis = TRUE
:knitr::asis_output()
return.asis = FALSE
:writeLines()
return.
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
#>