Closed anthonyhan closed 5 years ago
Thanks for opening this issue, maintainers will get back to you as soon as possible!
Issue-Label Bot is automatically applying the label Bug
to this issue, with a confidence of 0.72. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
Could you please provide URLs to your blog? I can't reach your localhost
...
Could you please provide URLs to your blog? I can't reach your
localhost
...
next theme version: 7.4.0
thanks for your time!
Limbo-NovaCarpe Diem
The top of contents
section in your page is malformed:
https://github.com/anthonyhan/anthonyhan.github.io/blob/eb29ba01d164a86a5d0f2f167c8393afcc18c7ba/about/index.html#L354
<a class="nav-link" href="#null">
Check if all headings in your markdown source code is used properly: https://github.com/theme-next/hexo-theme-next/issues/882#issuecomment-494202392
GitHubhexo blog. Contribute to anthonyhan/anthonyhan.github.io development by creating an account on GitHub.
If you are using marked, make sure headerIds is enabled.
Thanks for your kind reply!
@jiangtj I'm using hexo-renderer-markdown-it
@stevenjoezhang I tried it in a new post with a heading # only and had not luck.
---
title: hello world
date: 2019-09-18 14:30:29
tags:
---
# Test
some text.
I'm using
hexo-renderer-markdown-it
Yes, there are problems in hexo-renderer-markdown-it
Orz
for reproducing this issue, I created a new site for testing.
package.json: replace marked with markdown-it only
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"hexo": {
"version": "3.9.0"
},
"dependencies": {
"hexo": "^3.9.0",
"hexo-generator-archive": "^0.1.5",
"hexo-generator-category": "^0.1.3",
"hexo-generator-index": "^0.2.1",
"hexo-generator-tag": "^0.2.0",
"hexo-renderer-ejs": "^0.3.1",
"hexo-renderer-stylus": "^0.3.3",
"hexo-renderer-markdown-it": "^3.4.1",
"hexo-server": "^0.3.3"
}
}
modifications on _config.yml of HEXO
# Markdown-it config
## Docs: https://github.com/celsomiranda/hexo-renderer-markdown-it/wiki
markdown:
render:
html: true
xhtmlOut: false
breaks: false
linkify: false
typographer: false
quotes: '“”‘’'
create a new post
---
title: hello world
date: 2019-09-18 14:54:03
tags:
---
# Test
some text.
It will reproduce this error exactly.
@jiangtj is right. It seems there's something wrong with hexo-renderer-markdown-it
.
Hope it helps. Do I need to close issue?
You can close it. It's a bug of hexo-renderer-markdown-it
: https://github.com/hexojs/hexo-renderer-markdown-it/issues/55
I fixed it by adding a plugin of hexo-renderer-markdown-it markdown-it-named-headings
.
Thanks again!
Now I also encountered this problem, through npm install markdown-it-named-headings --save
,
then add option - markdown-it-named-headings
in Hexo main config.yml.This is good!
I fixed it by adding a plugin of hexo-renderer-markdown-it
markdown-it-named-headings
.
hexo-renderer-markdown-it actually has built-in support for adding anchor link to headings, but alas it's not enabled by default and the documentation is quite hidden.
To enable,
markdown:
anchor:
level: 2
level 2 starts with ## title
. If you want to start with # title
, set level 1 (not recommended because post's title usually is <h1>
, so toc would include post title).
I'll submit a PR to enable it by default.
Edit: https://github.com/hexojs/hexo-renderer-markdown-it/pull/90
Expected behavior
The post with toc showing in the sidebar should be loaded normally.
Actual behavior
any post with a toc in the sidebar can not loaded. Error text shows as below:
Related code: https://github.com/theme-next/hexo-theme-next/blob/v7.4.0/source/js/utils.js#L315
links in toc from the sidebar seemed broken.
Steps to reproduce the behavior
sections.forEach(item => intersectionObserver.observe(item));
.sections
, but both of them arenull
.Hexo Information
Package dependencies Information
Hexo Version
Hexo Configuration
NexT Configuration
Other Information