Skip to content

The head selector needs to be improved #8

@caoguanghui

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)

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