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

math_method: "r-katex" breaks HTML rendering #768

Open
ProfFan opened this issue Sep 18, 2024 · 3 comments
Open

math_method: "r-katex" breaks HTML rendering #768

ProfFan opened this issue Sep 18, 2024 · 3 comments

Comments

@ProfFan
Copy link

ProfFan commented Sep 18, 2024

math_method: "r-katex" breaks HTML rendering.

If I set it to r-katex all generated HTML will have the Rmd header incorrectly added to the HTML:

<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" data-external="1">
---
title: &apos;
---
R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin23.4.0
Running under: macOS 15.0

Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8

Package version:
  base64enc_0.1.3   blogdown_1.19     bookdown_0.40     bslib_0.8.0      
  cachem_1.1.0      cli_3.6.3         digest_0.6.36     evaluate_0.24.0  
  fastmap_1.2.0     fontawesome_0.5.2 fs_1.6.4          glue_1.7.0       
  graphics_4.4.1    grDevices_4.4.1   highr_0.11        htmltools_0.5.8.1
  httpuv_1.6.15     jquerylib_0.1.4   jsonlite_1.8.8    knitr_1.48       
  later_1.3.2       lifecycle_1.0.4   magrittr_2.0.3    memoise_2.0.1    
  methods_4.4.1     mime_0.12         promises_1.3.0    R6_2.5.1         
  rappdirs_0.3.3    Rcpp_1.0.13       rlang_1.1.4       rmarkdown_2.28   
  sass_0.4.9        servr_0.31        stats_4.4.1       tinytex_0.53     
  tools_4.4.1       utils_4.4.1       xfun_0.46         yaml_2.3.10      

Hugo version: 0.134.2
@yihui
Copy link
Member

yihui commented Sep 19, 2024

I'm not sure what's going on here (sounds like a blogdown bug), but perhaps it will be easier if you just disable the math_method and load katex in your Hugo template: https://katex.org/docs/browser

@ProfFan
Copy link
Author

ProfFan commented Sep 19, 2024

This is what I did, but it would be great if the rendering can be done on the server side instead.

I'm not sure what's going on here (sounds like a blogdown bug), but perhaps it will be easier if you just disable the math_method and load katex in your Hugo template: https://katex.org/docs/browser

@yihui
Copy link
Member

yihui commented Sep 19, 2024

Rendering on the server side makes it possible to view the math expressions offline, but it will also blow up the size of the HTML document. If your goal is to view math offline, you may also consider saving a copy of katex to the static/ folder and link to it in a Hugo template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants