Debian Codegraph @

man/knit_filter.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/utils-vignettes.R
3 \name{knit_filter}
4 \alias{knit_filter}
5 \title{Spell check filter for source documents}
6 \usage{
7 knit_filter(ifile, encoding = "UTF-8")
8 }
9 \arguments{
10 \item{ifile}{Filename of the source document.}
11
12 \item{encoding}{Ignored (the file \code{ifile} must be encoded in UTF-8).}
13 }
14 \value{
15 A character vector of the file content, excluding code chunks and
16 inline expressions.
17 }
18 \description{
19 When performing spell checking on source documents, we may need to skip R
20 code chunks and inline R expressions, because many R functions and symbols
21 are likely to be identified as typos. This function is designed for the
22 \code{filter} argument of \code{\link{aspell}()} to filter out code chunks
23 and inline expressions.
24 }
25 \examples{
26 library(knitr)
27 knitr_example = function(...) system.file("examples", ..., package = "knitr")
28 \donttest{
29 if (Sys.which("aspell") != "") {
30 # -t means the TeX mode
31 utils::aspell(knitr_example("knitr-minimal.Rnw"), knit_filter, control = "-t")
32
33 # -H is the HTML mode
34 utils::aspell(knitr_example("knitr-minimal.Rmd"), knit_filter, control = "-H -t")
35 }
36 }
37 }