Skip to content

TOC seems not suitable when skipping heading levels #2137

Open
@selfboot

Description

@selfboot

When there is a link in the header, such as:

# Header1

Content....

# [Header2](http://selfboot.cn)

content...

## Sub Header

content...

Then the toc generated seems a bit strange, just looks like:

<ol class="toc">
<li class="toc-item toc-level-1">
...
</ol>
<li class="toc-item toc-level-1"><a class="toc-link" href="#Sub Header"><span class="toc-number">2.</span> <span class="toc-text">Sub Header</span></a></li>
...

Should not all the <li class="toc-item toc-level-*"> be in ol.toc ?

Version:

$ hexo --version
hexo: 3.2.2
hexo-cli: 1.0.2
os: Darwin 15.6.0 darwin x64
http_parser: 2.7.0
node: 6.4.0
v8: 5.0.71.60
uv: 1.9.1
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 57.1
modules: 48
openssl: 1.0.2h

And in this blog, there is a live demo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions