gt: how to modify line spacing in cells with mutli-line text


I try to modify the distance between lines in a cell with a longer text which includes line breaks. I tried

tab_options( data_row.padding = px(.5) )

however this only reduces the vertical space between the first/last line and the cell's border.

What I am looking for is a way to decrease the space between the lines, i.e. to make the table more compact.


mtcars <- mtcars %>% 
  mutate(text="long text with line breaks\nlong text with linebreaks\nlong text with linebreaks")

mtcars %>% 
  tibble::rownames_to_column(., var = "name") %>% 
  select(name, text) %>% 
  gt() %>% 
  gt::tab_header(., title="row padding .5") %>% 
    data_row.padding = px(.5) 

Note that I am producing this table as part of a blog/distill post.
Here's the code/result of what I tried.

Many thanks!