Closed GegznaV closed 4 years ago
This is a gridtext issue.
Just wondering whether gridtext
has plan to support this feature?
This my solution for superscript and subscript. Hope that helps.
#' @importFrom stringr str_replace_all
#' @export
str_mk <- function(x) {
replacement <- c(
"(\\^\\{?)([\\w\\+\\-\\*\\\\]*)(\\}?)" = "<sup>\\2</sup>",
"(\\_\\{?)([\\w\\+\\-\\*\\\\]*)(\\}?)" = "<sub>\\2</sub>",
"\n" = "<br>"
)
str_replace_all(x, replacement)
}
x = c(
"gC m^{-2} d^{-1}",
"gC m^-2 d^-1",
"gC m_{-2} d_{-1}",
"gC m_-2 d_-1",
"gC \n mm/d"
)
str_mk(x)
#> [1] "gC m<sup>-2</sup> d<sup>-1</sup>" "gC m<sup>-2</sup> d<sup>-1</sup>"
#> [3] "gC m<sub>-2</sub> d<sub>-1</sub>" "gC m<sub>-2</sub> d<sub>-1</sub>"
#> [5] "gC <br> mm/d"
As a user, I expect all basic Markdown syntax (see bullets 1, 2, and 3 below) to be supported correctly. Making new lines, bold, and italic text as well as escaping symbols (
\* \_" \^ \~ \\ $
) works as expected.But there are the following issues:
1) Superscript tags do not close correctly (see examples below). 2) Making subscripts, endashes, and emdashes does not work at all (see examples below). 3) If I try to make verbatim code and strikethrough text, the error messages state that tags
<code>
and<del>
are not supported (see examples below). Most probably, it's an issue in gridtext package. 4) There is an issue in rendering LaTeX equations, but as understood, work is in progress (#4).The examples of issues in rendering Markdown syntax elements (sorry for the large images: I'm not sure how to control the size of them with reprex)
Created on 2020-01-30 by the reprex package (v0.3.0)
The examples of code with Markdown syntax elements that are rendered as expected.