Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using gt::md() renders different markdown syntax differently, depending upon where it is called. #1892

Open
rich-iannone opened this issue Sep 26, 2024 · 2 comments

Comments

@rich-iannone
Copy link
Member

rich-iannone commented Sep 26, 2024

Using gt::md() renders different markdown syntax differently, depending upon where it is called.

Reprex:

---
format:
   docx: default
---


```{r}
gt::gt(gt::sp500[1:10, ]) |>
  gt::tab_header(gt::md("**Test header** <br>*__Test header two__*")) |>
  gt::tab_footnote(gt::md("_Test footnote_ <br>*__Test footnote two__*"))

Note:

  • The header respects the bold and italics, but not the line break
  • The footer does not respect any of the markdown syntax
Screenshot 2024-09-26 at 16 17 06

Versions:

  • gt: 0.11.0.9000
  • quarto: 1.5.57

Originally posted by @MikeJohnPage in #1067 (comment)

@rjazwiec
Copy link

rjazwiec commented Oct 11, 2024

Will add here because my issue is very similar.

code:

 tab_spanner(., label = md("t~max~ [h]"), columns = matches("tmax")) %>% 
  tab_spanner(., label = md("C~max~ [ng/mL]"), columns = matches("cmax")) %>%
  tab_spanner(., label = md("t~1/2~ [h]"), columns = matches("t1_2")) %>%
  tab_spanner(., label = md("AUC~0-24h~ [h×ng/mL]"), columns = matches("auc_0_24h"))

generates output like this:
tab_sp_20mg_cr1

when there are only numbers and letters in the subscript part everything renders properly:

tab_sp_20mg_cr2

Any other sign between ~ makes it render strikethrough instead of subscript (vulgar ½ doesn't work either)

tab_sp_20mg_cr3

It works like this in pdf, png, html. In docx output it doesn't render subscript in tab_spanner at all just puts Cmax as it is with tildas visible

Best regards
Radek

ps. I just saw that GH has done the same with Cmax above. max is typed between ~ (one per side not two) and is rendered as striketrough.

@rjazwiec
Copy link

Also md("AUC$_{0-24h}$ [h×ng/mL]") renders properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants