Skip to content

Commit

Permalink
Revert "close yihui#2206: check the version of markdown before callin…
Browse files Browse the repository at this point in the history
…g markdown::mark_html()"

This reverts commit df7cf4b. markdown v1.3 was released on 2022-10-30, which I think is old enough now.
  • Loading branch information
yihui committed Aug 31, 2023
1 parent 3245aab commit 4dab17a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion R/template.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ stitch = function(script,
message('PDF output at: ', with_ext(out, 'pdf'))
}, md = {
out.html = with_ext(out, 'html')
mark_html(out, out.html)
markdown::mark_html(out, out.html)
message('HTML output at: ', out.html)
})
out
Expand Down
13 changes: 3 additions & 10 deletions R/utils-conversion.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,9 @@ knit2html = function(
out = knit(input, text = text, envir = envir, quiet = quiet)
if (is.null(text)) {
output = with_ext(if (is.null(output) || is.na(output)) out else output, 'html')
mark_html(out, output, ...)
markdown::mark_html(out, output, ...)
invisible(output)
} else mark_html(text = out, ...)
}

mark_html = function(...) {
if (packageVersion('markdown') < '1.3') stop(
"The 'markdown' package version >= 1.3 is required."
)
markdown::mark_html(...)
} else markdown::mark_html(text = out, ...)
}

#' Knit an R Markdown document and post it to WordPress
Expand Down Expand Up @@ -225,7 +218,7 @@ knit2wp = function(
)
out = knit(input, envir = envir); on.exit(unlink(out))
content = file_string(out)
content = mark_html(text = content)
content = markdown::mark(text = content)
shortcode = rep(shortcode, length.out = 2L)
if (shortcode[1]) content = gsub(
'<pre><code class="([[:alpha:]]+)">(.+?)</code></pre>',
Expand Down
2 changes: 1 addition & 1 deletion R/utils-rd2html.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ knit_rd = function(pkg, links = tools::findHTMLlinks(), frame = TRUE) {
toc = sprintf('- <a href="%s" target="content">%s</a>', paste0(topics, '.html'), topics)
toc = c(paste0('# ', pkg), '', toc, '',
paste('Generated with [knitr](https://yihui.org/knitr) ', packageVersion('knitr')))
mark_html(text = toc, output = '00frame_toc.html', meta = list(
markdown::mark_html(text = toc, output = '00frame_toc.html', meta = list(
title = paste('R Documentation of', pkg), css = 'R.css'
))
txt = read_utf8(file.path(find.package(pkg), 'html', '00Index.html'))
Expand Down

0 comments on commit 4dab17a

Please sign in to comment.