-
Notifications
You must be signed in to change notification settings - Fork 235
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
\item{[
}{...} translated incorrectly in Markdown mode
#555
Comments
@hadley I don't think this needs to be fixed before the release. |
Actually, this seems to be fine for me: roc <- rd_roclet()
out1 <- roc_proc_text(roc, "
#' Title
#'
#' Description.
#'
#' \\describe{
#' \\item{`[`}{This.}
#' \\item{`[[`}{That.}
#' }
#'
#' @md
foo <- function() {}")[[1]]
out2 <- roc_proc_text(roc, "
#' Title
#'
#' Description.
#'
#' \\describe{
#' \\item{\\code{[}}{This.}
#' \\item{\\code{[[}}{That.}
#' }
#'
foo <- function() {}")[[1]]
expect_equivalent_rd(out1, out2) Do you have a self-contained example that fails? |
Adding a simple link breaks it: roc <- rd_roclet()
out1 <- roc_proc_text(roc, "
#' Title
#'
#' Description.
#'
#' \\describe{
#' \\item{`[`}{This.}
#' \\item{`[[`}{That. [subset()]. }
#' }
#'
#' @md
foo <- function() {}")[[1]]
out1 Output:
|
This looks like a bug indeed. |
I see a possibly related problem with
which generates
|
Slightly more minimal reprex: out <- roc_proc_text(rd_roclet(), "
#' Title
#'
#' `[[`. [subset()]
#'
#' @md
foo <- function() {}")[[1]]
out$get_field("description") |
Actually a minimal reprex: add_linkrefs_to_md("`[[`. [subset()]")
#> [1] "`[[`. [subset()]\n\n[[`. [subset()]: R:[%60.%20[subset()\n" |
The problem appears to be that the regexp is matching too much - from the first I think the fix is to also disallow matching cat(add_linkrefs_to_md("`[[`. [subset()]"))
#> `[[`. [subset()]
#>
#> [subset()]: R:subset() |
That gives me this regexp: regex("(?<=[^]]|^)\\[([^\\]\\[]+)\\](?:\\[([^\\]\\[]+)\\])?(?=[^\\[]|$)") That doesn't break any unit tests, but I don't understand it fully, so I'll wait for approval from @gaborcsardi before changing. |
Similar issue using 6.0.1.9000. I only list it here for completeness for tests since these don't actually involve links, and in my use case I have the workaround of switching the order of the bullets.
DESCRIPTION:
Also, this is what the failing rd looks like:
|
tidyverse/tibble@0c4a581
The text was updated successfully, but these errors were encountered: