Skip to contents
loading...

Create a rich-formatted paragraph using markdown notation for flextable objects

Usage

para_md(
  ...,
  h.fonts = rep(flextable::get_flextable_defaults()$font.family, 6),
  h.sizes = c(15, 13, 9),
  h.colors = c("black", "darkgray"),
  strike.color = h.colors[2],
  strike.underline = NA,
  code.font = "inconsolata",
  code.shading = "#f8f8f8",
  link.color = "blue",
  link.underline = TRUE,
  bullet = "·",
  autolink = TRUE,
  smart = TRUE,
  debug = FALSE
)

# S3 method for paragraph
print(x, ...)

Arguments

...

the character strings with markdown formatting

h.fonts

fonts used for the titles (h1-h6)

h.sizes

font sizes for titles

h.colors

font colors for titles

strike.color

color for strikethrough text

strike.underline

is strikethrough text converted into underlined text?

code.font

font used for code strings

code.shading

background color (shading) for code strings

link.color

color used for URL links

link.underline

are URL links underlined?

bullet

bullet character used for lists

autolink

are links automatically constructed when there is an URL in the text?

smart

is smart punctuation detected and replaced?

debug

switch in debug mode

x

A paragraph object

Value

a flextable paragraph object with its content formatted according to markdown tags

Examples

md1 <- paste0("# Heading **1**\n## Heading **2**\n### Heading **3**\n",
  "#### Heading **4**\n##### Heading **5**\n###### Heading **6**")
md2 <- paste0("* List 1\n  1. List 1a\n  2. List 1b\n* List 2\n<br />\n",
  "*Some text* with super^script^, sub~script~ and ~~color~~{+#F50490}")
tabularise(head(iris)) |>
  Stb$add_footer_lines(para_md(md1, md2))

Sepal.Length

Sepal.Width

Petal.Length

Petal.Width

Species

5.1

3.5

1.4

0.2

setosa

4.9

3.0

1.4

0.2

setosa

4.7

3.2

1.3

0.2

setosa

4.6

3.1

1.5

0.2

setosa

5.0

3.6

1.4

0.2

setosa

5.4

3.9

1.7

0.4

setosa

Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6* List 1
· List 1a
· List 1b· List 2
*Some text* with superscript, subscript and color