Skip to content

Commit

Permalink
fix simplify_image_links (see tidyverse#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcaseb committed Nov 19, 2024
1 parent 6c0b931 commit 242fa8c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion R/reprex_render.R
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,14 @@ remove_info_strings <- function(x) {
# input: ![](https://i.imgur.com/woc4vHs.png)
# output: https://i.imgur.com/woc4vHs.png
simplify_image_links <- function(x) {
sub("(^!\\[\\]\\()(.+)(\\)$)", "\\2", x, perl = TRUE)
x <- remove_empty_html_comments(x)
sub("(^!\\[\\]\\()(.+)(\\))$", "\\2", x, perl = TRUE)
}

# input: ![](https://i.imgur.com/woc4vHs.png)<!-- -->
# output: ![](https://i.imgur.com/woc4vHs.png)
remove_empty_html_comments <- function(x){
sub("<!--[[:space:]]*-->", "", x, perl = TRUE)
}

# used when venue is "rtf"
Expand Down

0 comments on commit 242fa8c

Please sign in to comment.