Skip to content

Commit

Permalink
Require markdown >= 1.3 and update usage (#745)
Browse files Browse the repository at this point in the history
* Stop importing markdown::markdownExtensions()

This function will be removed in a future version of **markdown**.

* The extensions and fragment.only arguments will be removed, too

using options = 'fragment_only` will be equivalent to `fragment.only = TRUE`

* Update learnr-package.R

[ci skip]

* no need to import in namespace; just use `markdown::markdownToHTML()`

* require markdown >= 1.3, and call mark_html(options = '-standalone') instead of using the deprecated option `fragment_only` (the `mathjax` option is enabled by default, so no need to specify it)

* add news
  • Loading branch information
yihui authored and gadenbuie committed Nov 8, 2022
1 parent f7cba37 commit 8713e2a
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Imports:
jsonlite,
knitr (>= 1.31),
lifecycle,
markdown,
markdown (>= 1.3),
parallel,
promises,
rappdirs,
Expand Down
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ importFrom(knitr,opts_hooks)
importFrom(knitr,opts_knit)
importFrom(knitr,spin)
importFrom(lifecycle,deprecated)
importFrom(markdown,markdownExtensions)
importFrom(markdown,markdownToHTML)
importFrom(promises,"%>%")
importFrom(promises,promise)
importFrom(promises,then)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# learnr (development version)

- Bumped **markdown** package version requirement to v1.3 and stopped using deprecated functions and options from its older versions (#745).

# learnr 0.11.1

This is a maintenance release that adjusts an example and several tests for CRAN.
Expand Down
2 changes: 0 additions & 2 deletions R/learnr-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#' @importFrom knitr opts_knit
#' @importFrom knitr spin
#' @importFrom lifecycle deprecated
#' @importFrom markdown markdownExtensions
#' @importFrom markdown markdownToHTML
#' @importFrom rprojroot find_root
#' @importFrom rprojroot is_r_package
#' @importFrom shiny invalidateLater
Expand Down
8 changes: 1 addition & 7 deletions R/quiz.R
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,7 @@ quiz_text <- function(text) {
text <- format(text)
}
# convert markdown
md <- markdown::markdownToHTML(
text = text,
options = c("use_xhtml", "fragment_only", "mathjax"),
extensions = markdown::markdownExtensions(),
fragment.only = TRUE,
encoding = "UTF-8"
)
md <- markdown::mark_html(text = text, options = "-standalone")
if (length(str_match_all(md, "</p>", fixed = TRUE)) == 1) {
# remove leading and trailing paragraph
md <- sub("^<p>", "", md)
Expand Down

0 comments on commit 8713e2a

Please sign in to comment.