knit_filter

0th

Percentile

Spell check filter for source documents

When performing spell checking on source documents, we may need to skip R code chunks and inline R expressions, because many R functions and symbols are likely to be identified as typos. This function is designed for the filter argument of aspell() to filter out code chunks and inline expressions.

Usage
knit_filter(ifile, encoding = "UTF-8")
Arguments
ifile

Filename of the source document.

encoding

Ignored (the file ifile must be encoded in UTF-8).

Value

A character vector of the file content, excluding code chunks and inline expressions.

Aliases
  • knit_filter
Examples
# NOT RUN {
library(knitr)
knitr_example = function(...) system.file("examples", ..., package = "knitr")
# }
# NOT RUN {
if (Sys.which("aspell") != "") {
    # -t means the TeX mode
    utils::aspell(knitr_example("knitr-minimal.Rnw"), knit_filter, control = "-t")
    
    # -H is the HTML mode
    utils::aspell(knitr_example("knitr-minimal.Rmd"), knit_filter, control = "-H -t")
}
# }
Documentation reproduced from package knitr, version 1.23, License: GPL

Community examples

Looks like there are no examples yet.