Debian Codegraph @

man/prose_index.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/markdown.R
3 \name{prose_index}
4 \alias{prose_index}
5 \title{Find the indices of lines in Markdown that are prose (not code blocks)}
6 \usage{
7 prose_index(x, warn = TRUE)
8 }
9 \arguments{
10 \item{x}{A character vector of text in Markdown.}
11
12 \item{warn}{Whether to emit a warning when code fences are not balanced.}
13 }
14 \value{
15 An integer vector of indices of lines that are prose in Markdown.
16 }
17 \description{
18 Filter out the indices of lines between code block fences such as \verb{```}
19 (could be three or four or more backticks).
20 }
21 \note{
22 If the code fences are not balanced (e.g., a starting fence without an
23 ending fence), this function will treat all lines as prose.
24 }
25 \examples{
26 library(xfun)
27 prose_index(c("a", "```", "b", "```", "c"))
28 prose_index(c("a", "````", "```r", "1+1", "```", "````", "c"))
29 }