# Convert the syntax of theorem and proof environments from code blocks to fenced Divs

This function converts the syntax ```` ```{theorem, label, ...} ```` to
`::: {.theorem #label ...}` (Pandoc's fenced Div) for theorem
environments.

## Usage

``` r
fence_theorems(input, text = xfun::read_utf8(input), output = NULL)
```

## Arguments

- input:

  Path to an Rmd file that contains theorem environments written in the
  syntax of code blocks.

- text:

  A character vector of the Rmd source. When `text` is provided, the
  `input` argument will be ignored.

- output:

  The output file to write the converted input content. You can specify
  `output` to be identical to `input`, which means the input file will
  be overwritten. If you want to overwrite the input file, you are
  strongly recommended to put the file under version control or make a
  backup copy in advance.

## Value

If `output = NULL`, the converted text is returned, otherwise the text
is written to the output file.

## References

Learn more about [theorems and
proofs](https://pkg.yihui.org/bookdown/markdown-extensions-by-bookdown.html#theorems)
and [custom
blocks](https://pkg.yihui.org/rmarkdown-cookbook/custom-blocks.html) in
the bookdown book.
