Skip to content

Commit

Permalink
Highlight template code for optional arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebKrantz committed Jun 1, 2024
1 parent 1081f7b commit 698a5b8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/highlight.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ highlight_text <- function(text) {
text <- gsub("[[(", "`[[`(", text, fixed = TRUE)
text <- gsub("[(", "`[`(", text, fixed = TRUE)
text <- gsub("$(", "`$`(", text, fixed = TRUE)
# For fast-statistical-functions.Rd
text <- gsub(", [w = NULL,]", ", w = NULL,", text, fixed = TRUE)
text <- gsub(", [na.rm = TRUE,]", ", na.rm = TRUE,", text, fixed = TRUE)
text <- gsub(", [nthreads = 1L,]", ", nthreads = 1L,", text, fixed = TRUE)
text <- gsub("[keep.w = TRUE,] [stub = TRUE,] [nthreads = 1L,]", "keep.w = TRUE, stub = TRUE, nthreads = 1L,", text, fixed = TRUE)
out <- downlit::highlight(text, classes = downlit::classes_pandoc())
# out <- gsub("<span class='fu'>`[[`</span>", "<span class='fu'>[[</span>", out, fixed = TRUE)
# out <- gsub("<span class='fu'>`[`</span>", "<span class='fu'>[</span>", out, fixed = TRUE)
Expand Down

0 comments on commit 698a5b8

Please sign in to comment.