| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/utils.R |
| 3 |
\name{wrap_rmd} |
| 4 |
\alias{wrap_rmd} |
| 5 |
\title{Wrap long lines in Rmd files} |
| 6 |
\usage{ |
| 7 |
wrap_rmd(file, width = 80, text = NULL, backup) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{file}{The input Rmd file.} |
| 11 |
|
| 12 |
\item{width}{The expected line width.} |
| 13 |
|
| 14 |
\item{text}{A character vector of text lines, as an alternative to \code{file}. If |
| 15 |
\code{text} is not \code{NULL}, \code{file} is ignored.} |
| 16 |
|
| 17 |
\item{backup}{Path to back up the original file in case anything goes |
| 18 |
wrong. If set to \code{NULL}, no backup is made. The default value is constructed |
| 19 |
from \code{file} by adding \code{__} before the base filename.} |
| 20 |
} |
| 21 |
\value{ |
| 22 |
If \code{file} is provided, it is overwritten; if \code{text} is |
| 23 |
provided, a character vector is returned. |
| 24 |
} |
| 25 |
\description{ |
| 26 |
This function wraps long paragraphs in an R Markdown file. Other elements are |
| 27 |
not wrapped: the YAML preamble, fenced code blocks, section headers and |
| 28 |
indented elements. The main reason for wrapping long lines is to make it |
| 29 |
easier to review differences in version control. |
| 30 |
} |
| 31 |
\note{ |
| 32 |
Currently it does not wrap blockquotes or lists (ordered or unordered). |
| 33 |
This feature may or may not be added in the future. |
| 34 |
} |
| 35 |
\examples{ |
| 36 |
wrap_rmd(text = c("```", "1+1", "```", "- a list item", "> a quote", "", |
| 37 |
paste(rep("this is a normal paragraph", 5), collapse = " "))) |
| 38 |
} |