Debian Codegraph @

man/fenced_block.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/markdown.R
3 \name{fenced_block}
4 \alias{fenced_block}
5 \alias{fenced_div}
6 \alias{make_fence}
7 \title{Create a fenced block in Markdown}
8 \usage{
9 fenced_block(x, attrs = NULL, fence = make_fence(x, char), char = "`")
10
11 fenced_div(...)
12
13 make_fence(x, char = "`", start = 3)
14 }
15 \arguments{
16 \item{x}{A character vector of the block content.}
17
18 \item{attrs}{A vector of block attributes.}
19
20 \item{fence}{The fence string, e.g., \code{:::} or \verb{```}. This will be
21 generated from the \code{char} argument by default.}
22
23 \item{char}{The fence character to be used to generate the fence string by
24 default.}
25
26 \item{...}{Arguments to be passed to \code{fenced_block()}.}
27
28 \item{start}{The number of characters to start searching \code{x} with. If the
29 string of this number of characters is found, add one more character, and
30 repeat the search.}
31 }
32 \value{
33 \code{fenced_block()} returns a character vector that contains both the
34 fences and content.
35
36 \code{make_fence()} returns a character string. If the block content
37 contains \code{N} fence characters (e.g., backticks), use \code{N + 1} characters as
38 the fence.
39 }
40 \description{
41 Wrap content with fence delimiters such as backticks (code blocks) or colons
42 (fenced Div). Optionally the fenced block can have attributes. The function
43 \code{fenced_div()} is a shorthand of \code{fenced_block(char = ':')}.
44 }
45 \examples{
46 # code block with class 'r' and ID 'foo'
47 xfun::fenced_block("1+1", c(".r", "#foo"))
48 # fenced Div
49 xfun::fenced_block("This is a **Div**.", char = ":")
50 # three backticks by default
51 xfun::make_fence("1+1")
52 # needs five backticks for the fences because content has four
53 xfun::make_fence(c("````r", "1+1", "````"))
54 }