File: prose_index.Rd

package info (click to toggle)
r-cran-xfun 0.20-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680 kB
  • sloc: ansic: 242; sh: 22; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 873 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/markdown.R
\name{prose_index}
\alias{prose_index}
\title{Find the indices of lines in Markdown that are prose (not code blocks)}
\usage{
prose_index(x, warn = TRUE)
}
\arguments{
\item{x}{A character vector of text in Markdown.}

\item{warn}{Whether to emit a warning when code fences are not balanced.}
}
\value{
An integer vector of indices of lines that are prose in Markdown.
}
\description{
Filter out the indices of lines between code block fences such as \verb{```}
(could be three or four or more backticks).
}
\note{
If the code fences are not balanced (e.g., a starting fence without an
  ending fence), this function will treat all lines as prose.
}
\examples{
library(xfun)
prose_index(c("a", "```", "b", "```", "c"))
prose_index(c("a", "````", "```r", "1+1", "```", "````", "c"))
}