quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.94k stars 325 forks source link

Trailing ::: at bottom of rendered html pages depending on quoting in `page-footer` #8932

Closed cderv closed 3 weeks ago

cderv commented 8 months ago

_Originaly discussed in https://github.com/quarto-dev/quarto-cli/discussions/8931

This will look like this: image

Now change the quoting of the YAML field

  page-footer:
    center:
      - text: "Project 'created'"

The ::: will disappear

image

It happens in 1.4 but not in 1.3

So probably something with

jhelvy commented 8 months ago

Thanks for this - makes sense that it's in the footer as it's showing on every page. I have rather complex footers that use site variables, etc., so I don't know how many others will run into this, but at least I know how to fix it for now.

cderv commented 8 months ago

I just noticed that this works.

website:
  page-footer:
    center: 'Project "created"'

but not

website:
  page-footer:
    center:
       - text: 'Project "created"'

Related in a way

cderv commented 8 months ago

Ok so #8575 gave me some hints, and this happens because we do create this hidden div

:::{.hidden render-id="footer-center-Project "created""}
Project "created"
:::

For the rendering, and the render-id attribute is not valid. The double quotes are not escaped

> quarto pandoc -t native -f markdown
:::{.hidden render-id="footer-center-Project "created""}
Project "created"
:::
^Z
[ Para
    [ Str ":::{.hidden"
    , Space
    , Str "render-id="
    , Quoted DoubleQuote [ Str "footer-center-Project" ]
    , Str "created\8221"
    , Quoted DoubleQuote [ Str "}" , SoftBreak , Str "Project" ]
    , Str "created\8221"
    , SoftBreak
    , Str ":::"
    ]
]

Escaping works

> quarto pandoc -t native -f markdown
:::{.hidden render-id="footer-center-Project \"created\""}
Project "created"
:::
^Z
[ Div
    ( ""
    , [ "hidden" ]
    , [ ( "render-id" , "footer-center-Project \"created\"" ) ]
    )
    [ Para
        [ Str "Project"
        , Space
        , Quoted DoubleQuote [ Str "created" ]
        ]
    ]
]

Using "Project 'created'" creates


:::{.hidden render-id="footer-center-Project 'created'"}
Project 'created'
:::

so it works

no issue when using center: 'Project "created"', it works because we use a global id

:::{.hidden render-id="footer-center"}
Project "created"
:::
retostauffer commented 5 months ago

Experienced the same when using double-quotes to add information to the footer (adding some custom HTML). As soon as it contains " the <p>:::</p> artifact is added at the end of each main.contaner as described above.

Software/system

Tested with quarto release version 1.4.554 as well as with pre-release candidates 1.5.37and1.5.39`, all showing the same behavior (Ubuntu linux).

Reproducing the error

Can easily be reproduced by adding the following to the footer (left, right, or center):

website:
  page-footer: 
    center:
      - text: '<a href=\"www.google.com\">foo</a>'

Same when using not escaping the double quotes (" instead of \").

Fix (changing quotes)

As outlined above, changing the quotes resolves the issue; artifacts no longer created.

      - text: "<a href='www.google.com'>foo</a>"