Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add transform_test() function #10

Merged
merged 3 commits into from Jul 30, 2018
Merged

Add transform_test() function #10

merged 3 commits into from Jul 30, 2018

Conversation

@alexpghayes
Copy link
Contributor

alexpghayes commented Jul 20, 2018

Realized it wasn't that hard to create the utility I asked for in #9.

library(roxygen2md)

text <- c(
  "Both \\emph{italics} and \\bold{bold} text.",
  "And here we have \\emph{italics} in some text.",
  "This is \\bold{bold} text."
)

transform_text(text)
#> [1] "Both *italics* and **bold** text."       
#> [2] "And here we have *italics* in some text."
#> [3] "This is **bold** text."

Created on 2018-07-20 by the reprex
package
(v0.2.0).

Copy link
Member

krlmlr left a comment

Thanks! It looks like the logic to convert a character vector to Markdown (the transformers list and the Reduce() call) is now duplicated, I think it's important to have it defined in one place only. Would you like to refactor the code so that roxygen2md() uses transform_text() internally?

@alexpghayes

This comment has been minimized.

Copy link
Contributor Author

alexpghayes commented Jul 23, 2018

De-duplicated. Wasn't sure how to handle passing the vector of transformers - let me know if you'd like me to do something else.

Copy link
Member

krlmlr left a comment

Thanks, this looks much better. How about a more expressive name like markdownify() for the function?

#'
#' @examples
#'
#' text <-

This comment has been minimized.

Copy link
@krlmlr

krlmlr Jul 29, 2018

Member

Is a c( missing here?

@krlmlr krlmlr merged commit 1eec095 into r-lib:master Jul 30, 2018
@krlmlr

This comment has been minimized.

Copy link
Member

krlmlr commented Jul 30, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.