Skip to content

Commit

Permalink
Escape HTML tags (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
maksymiuks authored Dec 11, 2023
1 parent f08d3f9 commit 1c738e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rd2markdown
Title: Convert Rd Files into Markdown
Version: 0.0.7
Version: 0.0.8
Authors@R:
c(
person(
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
rd2markdown 0.0.8
-----------------

* Escape HTML tags in the output of `rd2markdown.enumerate` and `rd2markdown.itemize`

rd2markdown 0.0.7
-----------------

Expand Down
4 changes: 2 additions & 2 deletions R/rd2markdown.R
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ rd2markdown.enumerate <- function(x, fragments = c(), ...) {
is_item <- cumsum(is_item)[cumsum(is_item) > 0L & !is_item]
items <- lapply(split(x, is_item), map_rd2markdown, collapse = "")
items <- lapply(items, function(xi) indent_newlines(trimws(xi), 3))
res <- paste0(seq_along(items), ". ", items, collapse = "\n")
res <- escape_html_tags(paste0(seq_along(items), ". ", items, collapse = "\n"))
block(res)
}

Expand All @@ -381,7 +381,7 @@ rd2markdown.itemize <- function(x, fragments = c(), ...) {
items <- vapply(items, map_rd2markdown, character(1L), ..., collapse = "")
items <- Filter(nchar, trimws(items))
items <- lapply(items, function(xi) indent_newlines(trimws(xi), 3))
res <- paste0(" * ", items, collapse = "\n")
res <- escape_html_tags(paste0(" * ", items, collapse = "\n"))
block(res)
}

Expand Down

0 comments on commit 1c738e9

Please sign in to comment.