Skip to content

Math in README.Rmd gets rendered as an image in README.md #2611

@marcboschmatas

Description

@marcboschmatas

As the title says, equations written with $$ $$ or $ $ get turned into an image when doing devtools::build_readme().

You can see the example in my repo, but it boils down to

$$
Y = X_0 \beta_1 + X_2\beta_2 + u
$$

being transformed into

![
Y = X\_0 \\beta\_1 + X\_2\\beta\_2 +
u
](https://latex.codecogs.com/png.image?%5Cdpi%7B110%7D&space;%5Cbg_white&space;%0AY%20%3D%20X_0%20%5Cbeta_1%20%2B%20X_2%5Cbeta_2%20%2B%20u%0A
"
Y = X_0 \\beta_1 + X_2\\beta_2 + u
")  

which is not an issue for Github readme, but when using devtools::build_site(), I guess it takes README.md as a source, which breaks the package site, like so.

Image

This was not a problem when using pkgdown 2.0.9, but when I last updated it, it broke.

FWIW I am using devtools 2.4.5.900 and pkgdown 2.1.3.9000

I have tried manually rendering README.rmd
and changing the output to

---
output:
  md_document:
    variant: gfm
---

but the result has been the same.

Real example
README.Rmd
https://github.com/marcboschmatas/partialling.out/blob/main/README.Rmd

Readme.md
https://github.com/marcboschmatas/partialling.out/blob/main/README.md
https://raw.githubusercontent.com/marcboschmatas/partialling.out/refs/heads/main/README.md

Website
https://marcboschmatas.github.io/partialling.out/

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