Open allenzhuaz opened 4 years ago
Maybe we can fix this. Can you provide a reproducible examples please? See https://github.com/r-lib/roxygen2/blob/master/.github/SUPPORT.md#making-a-reprex
Please see the reproducible example:
library(roxygen2) roc_proc_text(rd_roclet(), "
fun <- function(){return(NULL)} ")
Actual reprex:
library(roxygen2)
roc_proc_text(rd_roclet(), "
#' Title
#' @section Test:
#' \\if{latex}{
#' List example:
#' * 1st item
#' * 2nd item
#' * 3rd item
#' Table example:
#' | a | b |
#' |---|---|
#' | c | d |
#' }
#' @export
fun <- function(){return(NULL)}
")[[1]]
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{fun}
#> \alias{fun}
#> \title{Title}
#> \usage{
#> fun()
#> }
#> \description{
#> Title
#> }
#> \section{Test}{
#>
#> \if{latex}{
#> List example:
#> * 1st item
#> * 2nd item
#> * 3rd item
#> Table example:
#> | a | b |
#> |---|---|
#> | c | d |
#> }
#> }
Created on 2020-03-10 by the reprex package (v0.3.0)
I think getting this to work is going to be hard, because we'd have to parse the Rd in order to figure out which bits should be transformed.
According to my comments at https://github.com/r-lib/roxygen2/blob/357d856f6ccdb96b7a95b42bf747cf10e2a26fb3/R/markdown-escaping.R#L13-L16 this should work.
But it does not. It is probably not that hard, because we already escape these macros, so they are already parsed.
Yeah, so I think for this we need to add another mode to the roxygen_parse_tag()
C function, to only parse the first argument of \if
or \ifelse
and leave the rest in place.
Yeah, so I think for this we need to add another mode to the
roxygen_parse_tag()
C function, to only parse the first argument of\if
or\ifelse
and leave the rest in place.
Thanks for looking into this feature, still on demand for the feature in our development, wondering whether it will be implemented in the next released version?
We'll look at this issue before the next release, yes.
I really like the roxygen2 build markdown support with option Roxygen: list(markdown = TRUE) or @md, but when I wrote some documentation within the if{latex}{} condition, the markdown language did not work within the latex condition, even if I set the markdown support option.