Skip to content

Commit

Permalink
Merge pull request #1525 from slodge/master
Browse files Browse the repository at this point in the history
Possible performance improvement - call `utils::packageVersion` only once
  • Loading branch information
rich-iannone authored Jan 6, 2024
2 parents c1ed008 + 7d31165 commit 2e7d5d2
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -571,14 +571,9 @@ get_markdown_engine_fn <- function(
#' @noRd
process_text <- function(text, context = "html") {

# When processing text globally (outside of the `fmt_markdown()`
# function) we will use the 'markdown' package if it is available,
# otherwise the 'commonmark' package
if (utils::packageVersion("markdown") >= "1.5") {
md_engine <- "markdown"
} else {
md_engine <- "commonmark"
}
# `markdown` is used to process text globally outside of `fmt_markdown()`
# Previously, `commonmark` was used.
md_engine <- "markdown"

# If text is marked `AsIs` (by using `I()`) then just
# return the text unchanged
Expand Down

2 comments on commit 2e7d5d2

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.