### Bug description

When rendering an HTML document, if `reference-location` is set to "margin" and a footnote is added to a section title, the section title would be misplaced to the left of the page, e.g.,

![图片](https://github.com/quarto-dev/quarto-cli/assets/10095784/b02eef18-102b-4472-a183-89ff8ff8c9c4)


### Steps to reproduce

````qmd
---
title: "Minimum reproducible example"
format:
  html:
    reference-location: "margin"
---

## Section title with notes ^[some notes]

some text

## Section title without notes

some text
````

### Expected behavior

I expect the section title to be aligned with those without footnotes.


### Actual behavior

The section title is misplaced to the left of the page; see the following screenshot:

![图片](https://github.com/quarto-dev/quarto-cli/assets/10095784/b02eef18-102b-4472-a183-89ff8ff8c9c4)

### Your environment

- IDE: RStudio 2023.06.0+441
- OS: Ubuntu 22.04


### Quarto check output

[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.3.361
      Path: /opt/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.10.6
      Path: /usr/bin/python3
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.3.0
      Path: /usr/lib/R
      LibPaths:
        - /home/nick/R/x86_64-pc-linux-gnu-library/4.3
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.42
      rmarkdown: 2.20

[✓] Checking Knitr engine render......OK

dragonstyle
2023-06-17T16:02:38Z
zenggyu
bug triaged-to
v1.4
closed
HTML format: misplaced section title with footnote when `reference-location` is set to "margin"
https://github.com/quarto-dev/quarto-cli/issues/5957