Skip to content

The toc (with subMaxLevel) is generated twice when there's 2 embedded links in a page #1822

Closed
@julienw

Description

@julienw

Bug Report

Steps to reproduce

  1. Use this configuration:
      window.$docsify = {
        subMaxLevel: 2,
        loadSidebar: true
      };
  1. Use a _sidebar.md, it could be as simple as:
- [Home](/)
  1. add a file with 2 embedded files, such as:
# Hello

Hello world

## Title 1

Lorem ipsum

[insert something](file.mp4 ":include")

[insert something else](file.mp4 ":include")

You can also see it live in https://codesandbox.io/s/problem-with-docsify-4cyldv

What is current behaviour

The Toc is generated twice, but in a nested way. In the above example, this looks like it:

  • Home
    • Title 1
    • Hello
      • Title 1

See also this screenshot:
image

What is the expected behaviour

We have the TOC only once, this should look like this in this case:

  • Home
    • Title 1

This happens when there's only one embedded asset.

Other relevant information

  • Bug does still occur when all/other plugins are disabled?

  • Your OS: not relevant

  • Node.js version: not relevant

  • npm/yarn version: not relevant

  • Browser version: Firefox 103, but I also tried in Chrome stable, so I believei t's not relevant

  • Docsify version: 4.12.2

  • Docsify plugins: none

Please create a reproducible sandbox

https://codesandbox.io/s/problem-with-docsify-zl23lm

Mention the docsify version in which this bug was not present (if any)

I haven't tried earlier versions, it's the first time I try this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugconfirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions