R markdown adding plicrows to html code in header

Hi all,

Recently R Markdown started adding pilcrows to html text in the header:
imagen

the header code looks like this:

title: <center><font size="7"><b>A very cool analysis</b></font></center>
subtitle: <center><font size="4"><b>A very fancy project</b> <br> Your Organization</font></center>
author: <center><font size="3"><a href="http://researcher.website.com/">Researcher name</a></font></center>
date: <center>"`r Sys.Date()`"</center>

does anyone now how to get rid of them?

thanks

1 Like

Is this for Word output ? Or HTML ?

Usually those are shown in DOCX editor as you activate the option to see them. Otherwise they are hidden.

But in which type of output are you seeing this ? You are using HTML code in your YAML so maybe HTML ?
Using tag like <center> is now considered obsolete, and also among block element not inline.

I don't think using them in YAML field like this will give you the expected results and it may creates more paragraph than you need, hence more pilcrows

thanks. Yes it is for a HTML output. It used to work find till a week ago. So that code stop working after an update. So is there other way to center those elements?

It seems it appears with Pandoc 2.19. If I use pandoc 2.18, I don't get those. So probably an upgrade of RStudio IDE has upgraded Pandoc and caused this behavior.

I still believe this is to show that somehting is wrong using block element on inlines. Usually to center element, you use custom CSS to change the default theme

You would need to learn a bit of CSS to know how to tweak style in a HTML doc. You could use this for example to center the part you want in the header

---
title: "**A very cool analysis**"
subtitle: "**A very fancy project** <br> Your Organization"
author: '<a href="http://researcher.website.com/">Researcher name</a>'
date: "`r Sys.Date()`"
output: html_document
---

```{css, echo = FALSE}
div#header h1.title, div#header h3.subtitle, div#header h4.author, div#header h4.date {
  text-align: center
}
```
1 Like

My understanding of the change in Pandoc is that before the YAML content was read as Blocks but now Inlines, which seems to add the ANSI code 182 (ASCII Code 182 (Windows-1252)) that shows in your document.

Maybe an issue in Pandoc :thinking:

Example for the author field before with Pandoc 2.18 when reading the metadata in AST

Pandoc
  Meta
    { unMeta =
        fromList
          [ ( "author"
            , MetaBlocks
                [ RawBlock (Format "html") "<center>"
                , Plain
                    [ RawInline (Format "html") "<font size=\"3\">"
                    , RawInline
                        (Format "html")
                        "<a href=\"http://researcher.website.com/\">"
                    , Str "Researcher"
                    , Space
                    , Str "name"
                    , RawInline (Format "html") "</a>"
                    , RawInline (Format "html") "</font>"
                    ]
                , RawBlock (Format "html") "</center>"
                ]
            )

after with Pandoc 2.19

Pandoc
  Meta
    { unMeta =
        fromList
          [ ( "author"
            , MetaInlines
                [ RawInline (Format "html") "<center>"
                , Space
                , Str "\182"
                , Space
                , RawInline (Format "html") "<font size=\"3\">"
                , RawInline
                    (Format "html")
                    "<a href=\"http://researcher.website.com/\">"
                , Str "Researcher"
                , Space
                , Str "name"
                , RawInline (Format "html") "</a>"
                , RawInline (Format "html") "</font>"
                , Space
                , Str "\182"
                , Space
                , RawInline (Format "html") "</center>"
                ]
            )

I had confirmation this was kind of an issue in Pandoc - The pilcrow you see is indeed because now metadata are considered blocks, but in future Pandoc version, it will be a space and no more a pilcrow.

Hi there, pilcrows are also showing when rendering to pdf and using a the latex command \vspace{-2in} in the title as in:

---
title: "\\vspace{-1in} Untitled"
author: "Johann Gutenberg"
date: "1455-12-16"
output: 
  pdf_document:
    keep_tex: true
---

I think I've been able to successfully downgrade the version of Pandoc used by rmarkdown as described here but I am still getting the pilcrows showing up. Would love to hear if someone has developed a workaround for pdf documents for the time being.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.