Skip to content

Maintaining GitHub alert syntax in README with devtools::build_readme() #2626

@jhelvy

Description

@jhelvy

I usually build the README.md file in my R packages with devtools::build_readme() from a README.Rmd file.

I use GitHub alerts like these in some of my README.Rmd files, but the alert syntax is not preserved after rendering. Here are two examples:

This README.Rmd:

---
output: github_document
---

> [!NOTE]
> A note

Renders to:

> \[!NOTE\] A note

Note how the brackets are escaped, which breaks the alert syntax.

I have also tried to maintain the syntax by placing this inside a markdown chunk, like this:

---
output: github_document
---

```{markdown}
> [!NOTE]
> A note
```

But this then renders with the markdown chunk still in place:

```{markdown}
> [!NOTE]
> A note
```

So this also doesn't work.

I'm not sure if this is an issue with devtools, knitr, or something else. I suspect it may be how knitr handles github documents, but I figured I would post the issue here first in case something is happening internally with devtools::build_readme()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions