diff --git a/R/unleash.R b/R/unleash.R index d1b14d4..0e8e1d2 100644 --- a/R/unleash.R +++ b/R/unleash.R @@ -118,7 +118,8 @@ handle_text <- function(text) { next_sibling <- xml2::xml_find_all(text, "following-sibling::*[1]") if (length(next_sibling) > 0 && xml2::xml_name(next_sibling) == "link") { end_space <- endsWith(xml2::xml_text(text), " ") - if (!end_space) { + end_left_parenthesis <- endsWith(xml2::xml_text(text), "(") + if (!end_space && !end_left_parenthesis) { xml2::xml_text(text) <- paste0(xml2::xml_text(text), " ") } } diff --git a/inst/example.md b/inst/example.md index 2fcd3e6..b631b52 100644 --- a/inst/example.md +++ b/inst/example.md @@ -29,4 +29,6 @@ This is a footnote [^ok]. [^ok]: Some more information. -R has well-developed plotting capabilities, and the `ggplot2` package is one of, if not the most powerful pieces of plotting software available today!!! We will begin learning to use `ggplot2` in the next episode. \ No newline at end of file +R has well-developed plotting capabilities, and the `ggplot2` package is one of, if not the most powerful pieces of plotting software available today!!! We will begin learning to use `ggplot2` in the next episode. + +This is a link in parentheses ([example](https://example.com)). \ No newline at end of file diff --git a/tests/testthat/_snaps/unleash.md b/tests/testthat/_snaps/unleash.md index 2482a08..99900ef 100644 --- a/tests/testthat/_snaps/unleash.md +++ b/tests/testthat/_snaps/unleash.md @@ -34,4 +34,6 @@ [29] "" [30] "R has well-developed plotting capabilities, and the `ggplot2` package is one of, if not the most powerful pieces of plotting software available today!!!" [31] "We will begin learning to use `ggplot2` in the next episode." + [32] "" + [33] "This is a link in parentheses ([example](https://example.com))."