Converts a markdown string to a paragraph object compatible with flextable. This allows using markdown syntax to format text in flextable cells.
Value
A paragraph object (class "paragraph") that can be used
with flextable::mk_par() or flextable::as_flextable().
Details
Supported markdown syntax:
**bold**or__bold__*italic*or_italic_`code`(monospace)~~strikethrough~~[link](url)(underlined and colored)(images)Line breaks with
\n\n(paragraph) or two spaces +\n(hard break)
Examples
library(flextable)
ft <- flextable(head(iris, 3))
ft <- mk_par(
ft,
j = 1,
part = "body",
value = as_paragraph_md("**Column1** has *values*")
)
ft
Sepal.Length
Sepal.Width
Petal.Length
Petal.Width
Species
Column1 has values
3.5
1.4
0.2
setosa
Column1 has values
3.0
1.4
0.2
setosa
Column1 has values
3.2
1.3
0.2
setosa
# With inline code
ft <- mk_par(
ft,
j = 2,
part = "body",
value = as_paragraph_md("Use `Sepal.Width` column")
)
ft
Sepal.Length
Sepal.Width
Petal.Length
Petal.Width
Species
Column1 has values
Use Sepal.Width column
1.4
0.2
setosa
Column1 has values
Use Sepal.Width column
1.4
0.2
setosa
Column1 has values
Use Sepal.Width column
1.3
0.2
setosa
