Skip to content

Markdown Headings not appearing correctly for non Starlight Content #3175

Closed
@awhitford

Description

@awhitford

What version of starlight are you using?

0.34.2

What version of astro are you using?

5.7.10

What package manager are you using?

pnpm

What operating system are you using?

Mac

What browser are you using?

Chrome

Describe the Bug

I have a Starlight Project that uses Markdown both from an Astro page, and with the Starlight Content.
After upgrading Starlight from 0.33.x to 0.34.x, it appears to have broken the Headings of my Astro Markdown page.

Headings are now rendered like:

<div class="sl-heading-wrapper level-h2">
  <h2 id="interpretation-and-definitions">Interpretation and Definitions</h2>
  <a class="sl-anchor-link" href="#interpretation-and-definitions">
    <span aria-hidden="true" class="sl-anchor-icon">
      <svg width="16" height="16" viewBox="0 0 24 24">
        ...
      </svg>
    </span>
  <span class="sr-only">Section titled “Interpretation and Definitions”</span>
  </a>
</div>

instead of just:

<h2 id="interpretation-and-definitions">Interpretation and Definitions</h2>

I don't have a problem with the revised HTML.
However, because the CSS classes that it is referencing (e.g., 'sl-heading-wrapper', 'sl-anchor-link', etc.) are not being loaded into the page, it is not being rendered correctly.
I also do not see a way to load these as only style/markdown.css is exported.

Image

I have create a simple project to reproduce the issue:

This may be related to #3162

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-starlight-tscz1rbh?file=README.md

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions