diff --git a/DESCRIPTION b/DESCRIPTION index 9a0861fb..d47048c1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: blogdown Title: Create Blogs and Websites with R Markdown -Version: 1.18.1 +Version: 1.18.2 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person("Christophe", "Dervieux", role = "aut", email = "cderv@posit.co", comment = c(ORCID = "0000-0003-4474-2498")), diff --git a/NEWS.md b/NEWS.md index 6c8ad769..d6c72f7d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # CHANGES IN blogdown VERSION 1.19 +- Fixed the bug that shortcodes were mangled when there are raw HTML blocks in the Markdown output from R Markdown (thanks, @Redcozmo, #759). # CHANGES IN blogdown VERSION 1.18 diff --git a/R/render.R b/R/render.R index 0b8e7f97..00d76dec 100644 --- a/R/render.R +++ b/R/render.R @@ -251,7 +251,13 @@ process_markdown = function(res, x = read_utf8(res)) { options = c('--wrap=preserve', '--preserve-tabs'), citeproc = TRUE ) - x = c(bookdown:::fetch_yaml(x), '', read_utf8(mds[2])) + x2 = read_utf8(mds[2]) + # pandoc will escape < and > in shortcodes, and below is a hack to restore them + if (get_option('blogdown.restore.shortcode', TRUE)) { + x2 = gsub('^\\{\\{\\\\< ([^ ])', '{{< \\1', x2) + x2 = gsub('([^ ]) \\\\>\\}\\}$', '\\1 >}}', x2) + } + x = c(bookdown:::fetch_yaml(x), '', x2) } x }