rmd2id: Get the chapter identifier

View source: R/rmd2id.R

rmd2idR Documentation

Get the chapter identifier

Description

Get the identifier for a book chapter given the Rmarkdown source code. This is usually derived from the chapter title but can also be explicitly specified.

Usage

rmd2id(path)

Arguments

path

String containing the path to the Rmarkdown file for a chapter.

Value

String containing the identifier for this chapter. If no identifier can be determined, NULL is returned.

Author(s)

Aaron Lun

Examples

tmp <- tempfile(fileext='.Rmd')
write('# some chapter name

blah', file=tmp)
rmd2id(tmp)

tmp2 <- tempfile(fileext='.Rmd')
write('# some chapter name {#chapter-id}

blah', file=tmp2)
rmd2id(tmp2)



LTLA/rebook documentation built on June 5, 2023, 6:24 p.m.