hsl
hsl

Reputation: 681

Blogdown and hugo not parsing html tags in markdown

I'm trying to build a website with blogdown in R and I'm not sure why html tags are no longer parsed properly. It used to work properly for me. I tested the code below in three new/different R projects (different Hugo themes) and nothing worked. However, when I try to knit or preview a regular Rmd or md file, the html tags are parsed correctly and everything works as intended.

For example, the following code in my markdown document has no effect on the text. Images also don't show up.

<a href="http://www.google.com">Link to Google</a>
<b>happy</b>

When I serve the site, what I see is just the following text, unformatted:

Link to Google happy

Note that standard markdown syntax still works:

[Link to Google](https://www.google.com)
**happy**

Expected output

Link to Google happy

Does anyone have any clue what could be the problem? Appreciate any help anyone can provide! Thanks.

And below are my R session info. I'm using the latest version of Hugo (0.65.0) and blogdown (also tried the development version). I downgraded to Hugo 0.60.0 and it still didn't work.

> xfun::session_info()
R version 3.6.2 (2019-12-12)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6, RStudio 1.2.5033

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

Package version:
  base64enc_0.1.3 bookdown_0.17   digest_0.6.24   evaluate_0.14   glue_1.3.1      graphics_3.6.2  grDevices_3.6.2
  highr_0.8       htmltools_0.4.0 jsonlite_1.6.1  knitr_1.28      magrittr_1.5    markdown_1.1    methods_3.6.2  
  mime_0.9        Rcpp_1.0.3      rlang_0.4.4     rmarkdown_2.1   stats_3.6.2     stringi_1.4.6   stringr_1.4.0  
  tinytex_0.19    tools_3.6.2     utils_3.6.2     xfun_0.12       yaml_2.2.1 

Upvotes: 3

Views: 1931

Answers (1)

Kevin Cazelles
Kevin Cazelles

Reputation: 1255

IIRC, Hugo >=0.60 now uses Goldmark (see https://gohugo.io/news/0.60.0-relnotes/) and so in order to use html tags in markdown file, you should add

[markup.goldmark.renderer]
unsafe = true

in your config.toml file (see the link above for the other formats).

Upvotes: 8

Related Questions