-
Notifications
You must be signed in to change notification settings - Fork 234
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
Inline rmarkdown results inserted in wrong place #1353
Comments
This looks like a roxygen2 issue. This: #' Topic
#' @name topic2
#' @param message foo
#' . bar `r "\\ifelse{foo}{bar}{baz}"`.
NULL Generates % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cnd-abort.R
\name{topic2}
\alias{topic2}
\title{Topic}
\arguments{
\item{message}{foo
. ba\ifelse{foo}{bar}{baz}"`.}
}
\description{
Topic
} It seems the |
Probably in bug in ... Maybe r-lib/downlit@3254d19 ? |
Hmmm, I can't reprex: library(roxygen2)
roc_proc_text(rd_roclet(), r"(
#' Topic
#' @name topic2
#' @param message foo
#' . bar `r "\\ifelse{foo}{bar}{baz}"`.
NULL
)")[[1]]
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{topic2}
#> \alias{topic2}
#> \title{Topic}
#> \arguments{
#> \item{message}{foo
#> . bar `r "\\ifelse{foo}{bar}{baz}"`.}
#> }
#> \description{
#> Topic
#> } Created on 2022-07-06 by the reprex package (v2.0.1) |
Ah, needed to force md on: library(roxygen2)
roc_proc_text(rd_roclet(), r"(
#' Topic
#' @md
#' @name topic2
#' @param message foo
#' . bar `r "\\ifelse{foo}{bar}{baz}"`.
NULL
)")[[1]]
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{topic2}
#> \alias{topic2}
#> \title{Topic}
#> \arguments{
#> \item{message}{foo
#> . ba\ifelse{foo}{bar}{baz}"`.}
#> }
#> \description{
#> Topic
#> } Created on 2022-07-06 by the reprex package (v2.0.1) |
Somewhat simpler reprex: library(roxygen2)
roc_proc_text(rd_roclet(), r"(
#' Title
#'
#' line1
#' 111 `r "222"` 333
#' @md
foo <- function() {}
)")[[1]]
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{foo}
#> \alias{foo}
#> \title{Title}
#> \usage{
#> foo()
#> }
#> \description{
#> line1
#> 12222"` 333
#> } Created on 2022-07-06 by the reprex package (v2.0.1) It's something to do with the leading indent — if you change the number of spaces, the corruption changes. |
Probably related to this comment in # Cmark has a bug when reporting source positions for multi-line
# code tags, and it does not count the indenting space in the
# continuation lines. However, the bug might get fixed later, so
# for now we just simply error for multi-line inline code. |
inform()
documentation problems
Yeah, unfortunately this seems to be a cmark bug: src <- "Title\n\nline1\n 111 `r \"222\"` 333\n"
cat(src)
cat(commonmark::markdown_xml(src, sourcepos = TRUE)) <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">
<document sourcepos="1:1-4:20" xmlns="http://commonmark.org/xml/1.0">
<paragraph sourcepos="1:1-1:5">
<text sourcepos="1:1-1:5" xml:space="preserve">Title</text>
</paragraph>
<paragraph sourcepos="3:1-4:20">
<text sourcepos="3:1-3:5" xml:space="preserve">line1</text>
<softbreak />
<text sourcepos="4:1-4:4" xml:space="preserve">111 </text>
<code sourcepos="4:6-4:12" xml:space="preserve">r "222"</code>
<text sourcepos="4:14-4:17" xml:space="preserve"> 333</text>
</paragraph>
</document> The |
Seems that the R package uses https://github.com/github/cmark-gfm, for the GFM extensions, I guess and there is no fix for this: https://github.com/github/cmark-gfm/releases I'll report it upstream. As for roxygen2, let me see if we can work around this. |
Found it in the cmark issue tracker, it does not seem like a thing that will be fixed soon: commonmark/cmark#296 |
Something is going wrong with the Rd snipped generated by the
link()
function:And
message
needs to mention "v" and "!", I'd suggest something like: Elements named"*"
,"i"
,"v"
, and"x"
, "!", are formatted as regular, info, success, failure, and error bullets respectively.The text was updated successfully, but these errors were encountered: