You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to update the RmdConcord package to support markdown::html_format (and maybe markdown::latex_format, but I'm not there yet). This requires the sourcepos = TRUE argument to be passed to commonmark::markdown_html. I can see how to do that, but the trouble is that the markdown::mark function causes problems with the result.
Specifically, with this file as input:
---
title: "Untitled"
output:
markdown::html_format:
keep_md: true
---
some text
I can see commonmark::markdown_html being called twice. Once is for the main text, and a second time is for the title. When I turn on the sourcepos = TRUE option, the main text is fine.
However, the output from commonmark::markdown_html for the title is "<p data-sourcepos=\"1:1-1:8\">Untitled</p>\n". The render() function within mark() cleans this up to "<p data-sourcepos=\"1:1-1:8\">Untitled\n", and that's not valid HTML because now the tags don't balance and we have an orphan <p data-sourcepos=\"1:1-1:8\"> stuck within the title in the final output:
There's a similar issue in in the body where the title is displayed.
Would you accept a PR that fixed this? I think it would be okay to completely remove the source reference when cleaning. It might be possible to fix it up to point to the YAML block, but that's probably messy.
The text was updated successfully, but these errors were encountered:
I'd like to update the
RmdConcord
package to supportmarkdown::html_format
(and maybemarkdown::latex_format
, but I'm not there yet). This requires thesourcepos = TRUE
argument to be passed tocommonmark::markdown_html
. I can see how to do that, but the trouble is that themarkdown::mark
function causes problems with the result.Specifically, with this file as input:
I can see
commonmark::markdown_html
being called twice. Once is for the main text, and a second time is for the title. When I turn on thesourcepos = TRUE
option, the main text is fine.However, the output from
commonmark::markdown_html
for the title is"<p data-sourcepos=\"1:1-1:8\">Untitled</p>\n"
. Therender()
function withinmark()
cleans this up to"<p data-sourcepos=\"1:1-1:8\">Untitled\n"
, and that's not valid HTML because now the tags don't balance and we have an orphan<p data-sourcepos=\"1:1-1:8\">
stuck within the title in the final output:There's a similar issue in in the body where the title is displayed.
Would you accept a PR that fixed this? I think it would be okay to completely remove the source reference when cleaning. It might be possible to fix it up to point to the YAML block, but that's probably messy.
The text was updated successfully, but these errors were encountered: