From 0b6199228848524a4b2ecfd4ab36a4da37312391 Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Thu, 6 Aug 2015 23:22:35 -0500 Subject: [PATCH] fixes rstudio/htmltools#30: when HTML code is empty, do not try to base64 encode images --- NEWS | 7 +++++++ R/renderMarkdown.R | 1 + 2 files changed, 8 insertions(+) diff --git a/NEWS b/NEWS index 92b107c..c439532 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ + CHANGES IN markdown VERSION 0.7.8 + +BUG FIXES + + o fixed https://github.com/rstudio/htmltools/issues/30: markdownToHTML() did + not work with empty files (thanks, @VermillionAzure) + CHANGES IN markdown VERSION 0.7.7 BUG FIXES diff --git a/R/renderMarkdown.R b/R/renderMarkdown.R index 79571a3..e6e85cb 100644 --- a/R/renderMarkdown.R +++ b/R/renderMarkdown.R @@ -158,6 +158,7 @@ renderMarkdown <- function( .b64EncodeImages <- function(html) { + if (length(html) == 0) return(html) reg <- "<\\s*[Ii][Mm][Gg]\\s+[Ss][Rr][Cc]\\s*=\\s*[\"']([^\"']+)[\"']" m <- gregexpr(reg, html, perl = TRUE) if (m[[1]][1] != -1) {