View source: R/Rmarkdown_utiilities.R
r_toc_for_Rmd | R Documentation |
Scans . Rmd file string for headings (#) and creates a table of contents (hyper linked). The returned string can directly be written as .Rmd file. All code section will be excluded for the (#) search.
r_toc_for_Rmd(
c_Rmd,
toc_heading_string = "Table of Contents",
create_nb = TRUE,
create_top_link = TRUE,
nb_front = TRUE,
set_first_heading_level = FALSE,
pagebreak_level = "non"
)
c_Rmd |
Rmd file string |
toc_heading_string |
title string for TOC, e.g "Inhaltsverzeichnis", default is "Table of contents". |
create_nb |
boolean to enable numbering for each heading. |
create_top_link |
boolean to create link below each heading to jump back to the table of contents. |
nb_front |
boolean to have the numbering in front of each heading. |
set_first_heading_level |
set first found heading level to heading 1 |
pagebreak_level |
Automatically add page breaks before new heading. Set the level to insert page breaks to e.g. c("non","1","2","3","4","5","6") |
The function argument is a string of a R markdown .Rmd file which can be read via readLines("fileName.Rmd")
.
.Rmd file string
print(tbl_of_contents.Rmd)
c_rmd <- r_toc_for_Rmd(tbl_of_contents.Rmd, create_nb = FALSE)
c_rmd
c_rmd <- r_toc_for_Rmd(tbl_of_contents.Rmd,
toc_heading_string = "Inhaltsverzeichnis", create_nb = TRUE)
c_rmd
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.