Skip to content

The head selector needs to be improved #8

Description

@caoguanghui
 document.querySelector(`#main ${window.$docsify.toc.target}`)

If config like this:

{
     tocMaxLevel: 6,
     target: 'h1, h2, h3, h4, h5, h6'
}

The selector#main h1, h2, h3, h4, h5, h6 will get h2-h5 of whole document and h1 in #main

Therefore, the following code seems more reasonable

const mainElement = document.querySelector('#main')
headings = mainElement.querySelectorAll(window.$docsify.toc.target)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions