gt
gt copied to clipboard
Bulleted lists only making 1 bullet
I'm really liking gt
. I might be doing something wrong here but I thought this code would result in a bulleted list
library(tidyverse)
library(glue)
library(gt)
mpg %>%
distinct(manufacturer, class, model) %>%
head(10) %>%
group_by(manufacturer) %>%
summarise(
about =
glue("* **{model}**: _{class}_") %>% # <--- where I'm trying to make bullets
glue_collapse("<br>")
) %>%
ungroup() %>%
gt() %>%
cols_align("left") %>%
fmt_markdown(columns = everything())
We will look into this because this definitely does not look right.
A closer to minimal reprex:
library(gt)
data.frame(column = "* blt1<br>* blt2") |>
gt() |>
fmt_markdown(columns = everything())
column |
---|
|
Created on 2024-01-25 with reprex v2.0.2
The issue seems to be with the commonmark dependency:
commonmark::markdown_html("* blt1<br>* blt2")
#> [1] "<ul>\n<li>blt1<br>* blt2</li>\n</ul>\n"
Created on 2024-01-25 with reprex v2.0.2
The output should be like this, I believe.
<ul>
<li>blt1</li>
<li>blt2</li>
</ul>
And using the newline character works as OP expected:
library(gt)
data.frame(column = "* blt1\n* blt2") |>
gt() |>
fmt_markdown(columns = everything())
column |
---|
|
Created on 2024-01-26 with reprex v2.0.2