Skip to content

Right-side navigation not respecting heading order when snippets are used #1880

@kilfoyle

Description

@kilfoyle

Describe the bug

In the PR docs preview, for a page that includes a snippet, the right-side "On this page" anchors appear to display in the wrong order.

I think this is low priority since there's a workaround: Instead of using one snippet that contains a few anchors, I used one small snippet file for each section in the parent page (see https://github.com/elastic/docs-content/pull/2569/files).

I had to merge my PR, but the parent file had this structure:

# Troubleshoot snapshot and index lifecycle management
## Check status, stop, and restart {{slm-init}}
### Get SLM status 
### Stop SLM 
### Start SLM
## Check status, stop, and restart ILM

:::{include} /manage-data/_snippets/ilm-status.md
:::

The included file had this structure:

### Get ILM status
### Stop ILM 
### Start ILM

In the PR docs preview, the right-side navigation displays out of order (the highlighted entries should be at the bottom):

Image

Expected behavior

In my local docs build preview, the right-side navigation displays as expected:

Image

Steps to reproduce

To reproduce,

  1. Create a docs md file with a few anchors
  2. Create a snippet with a few anchors.
  3. Include the snippet in the middle of the parent .md file using :::{include} /snippet-file.md
  4. Open a PR and check how the right-side navigation appears in the docs preview.

Tooling

  • docs-builder
  • migration tooling
  • I'm not sure
  • [ ]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions