I am using Rmarkdown and Pandoc with a custom template to make a report where I have a table showing the users who have approved the content of a report. In my template, I've put this signature block into the body element, but I get the same behavior whether I put it in <head>
, <header>
or anywhere else. I've had this working in Pandoc 2.11.2. Unfortunately, when upgrading to Pandoc 3.1.11, the appearance shifted. It appears that Pandoc is adding line break tags (<br />
) to the end of each tag in my table. Is there an option in Pandoc that can be leveraged to disable this behavior?
(apologies...yes this is a reposting of a question from last week. I've since been able to isolate it to the version of pandoc, but still can't seem to come up with the search terms that lead me to identifying what I can do to change this behvior)
<!DOCTYPE html>
<html>
<head>
</head>
<body style = "background-color:#C0C0C0">
$if(title)$
<font style = 'font-size:2.074em'>$title$</font>
<br/><br/>
$endif$
$body$
$if(signature)$
$signature$
$endif$
</body>
</html>
---
output:
html_document:
self_contained: true
template: RMtemplate.html
---
```{r, echo = FALSE}
cat(R.Version()$version.string)
cat(sprintf("rmarkdown version: %s", packageVersion("rmarkdown")))
cat(sprintf("pandoc version: %s", rmarkdown::find_pandoc()$version))
```
```{r, echo = FALSE}
TITLE <- "Report Title"
SIGNATURE <- "<table cellpadding = \"2\"><tr><td style = \"width:75%;border-bottom:solid black 1px;height:1in;\"></td><td style = \"width:5%;\"></td><td style = \"width:20%;border-bottom:solid black 1px;vertical-align:bottom\"></td></tr><tr><td>Approver 1 Role</td><td></td><td>Date</td></tr><tr><td style = \"width:75%;border-bottom:solid black 1px;height:1in;\"></td><td style = \"width:5%;\"></td><td style = \"width:20%;border-bottom:solid black 1px;vertical-align:bottom\">14 Jan 2025 13:18</td></tr><tr><td>User Name, Approver 2 Role</td><td></td><td>Date</td></tr></table>"
```
---
title: '`r TITLE`'
signature: '`r SIGNATURE`'
---
I'm not positive what commit to pandoc may have caused this change between those two versions, but I did find a solution that appears to solve your issue.
In your front matter YAML for your Rmd file:
---
output:
html_document:
self_contained: true
template: RMtemplate.html
pandoc_args: [
"--from", "markdown-markdown_in_html_blocks"
]
---
This change results in this appearance for the form:
Which appears to be identical to your previous version.
What I am doing is disabling the "markdown_in_html_blocks" extension from the "markdown" input format (which is Pandoc's markdown). You can read the documentation on this extension here.