r-lib / pkgdown

Generate static html documentation for an R package
https://pkgdown.r-lib.org/
Other
714 stars 334 forks source link

The markdown syntax for alerts is not rendered properly #2701

Open jmaspons opened 3 months ago

jmaspons commented 3 months ago

See Alerts

An example of alerts not rendered in pkgdown VS rendered on gh

jayhesselberth commented 3 months ago

Confirming GH alert blocks don't work in vignettes either. Nor do quarto callouts in quarto vignettes.

There are at least two issues:

  1. Markdown conversion to HTML. It is likely that GH is doing something under the hood to process these blocks. You might try to see if this markup is maintained after pandoc conversion. pkgdown does not have any of the special div classes associated with these blocks.
image
  1. CSS formatting. GitHub provides CSS classes for these blocks that we don't have in pkgdown.

So, I think this would be a fair bit of work to incoporate into pkgdown.

jayhesselberth commented 3 months ago

FWIW, I also tried the following, which also doesn't work:

  1. Create a README.qmd at the top level with the following header:
---
format: gfm
---
  1. Add a quarto callout to the page:
::: {.callout-note}
Note that there are five types of callouts, including:
`note`, `warning`, `important`, `tip`, and `caution`.
:::

Render that with quarto to README.md. If you click the "Render" button in RStudio it will use quarto to create README.md.

But unfortunately callouts are not currently supported in the quarto gfm format.

Yet another alternative is to create an README.qmd file but leave output: github_document in the YAML header. In this case, clicking Render will generate a README.html file that has correctly formatted quarto callouts. But I'm not sure what would happen if you add this to your GitHub repo --- My guess is that the README.md would continue to take precedence over README.html, as GH doesn't usually serve HTML files.

jayhesselberth commented 3 months ago

Also this is a dup of #2361.

But this issue from quarto makes me think the format: gfm strategy should work?

jayhesselberth commented 3 months ago

I also wonder if there are other features we can access using a README.qmd document with format: gfm.