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 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 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
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 krlmlr left a comment

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

R/transform.R Outdated
#'
#' @examples
#'
#' text <-
Copy link
Member

@krlmlr krlmlr Jul 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a c( missing here?

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

krlmlr commented Jul 30, 2018

Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants