The fmt_markdown() function

Create a few Markdown-based text snippets.

text_1a <- "
### This is Markdown.

Markdown’s syntax is comprised entirely of
punctuation characters, which punctuation
characters have been carefully chosen so as
to look like what they mean... assuming
you’ve ever used email.
"

text_1b <- "
Info on Markdown syntax can be found
[here](https://daringfireball.net/projects/markdown/).
"

text_2a <- "
The **gt** package has these datasets:

 - `countrypops`
 - `sza`
 - `gtcars`
 - `sp500`
 - `pizzaplace`
 - `exibble`
"

text_2b <- "
There's a quick reference [here](https://commonmark.org/help/).
"

Arrange the text snippets as a tibble using the dplyr::tribble() function. then, create a gt table and format all columns with fmt_markdown().

dplyr::tribble(
  ~Markdown, ~md,
  text_1a,   text_2a,
  text_1b,   text_2b,
) |>
  gt() |>
  fmt_markdown(columns = everything()) |>
  tab_options(table.width = px(400))
Markdown md

This is Markdown.

Markdown’s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean… assuming you’ve ever used email.

The gt package has these datasets:

  • countrypops
  • sza
  • gtcars
  • sp500
  • pizzaplace
  • exibble

Info on Markdown syntax can be found here.

There’s a quick reference here.