Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当文章存在层级目录时,进入阅读文章时,控制台出现(Cannot read properties of null (reading 'offsetTop'))【图一】错误,当点击层级目录时,控制台出现(Cannot read properties of undefined (reading 'top'))【图二】错误。 #98

Closed
wi-gang opened this issue Jan 12, 2022 · 16 comments
Assignees
Labels
🐛bug Something isn't working

Comments

@wi-gang
Copy link

wi-gang commented Jan 12, 2022

图一
image

图二
image

测试文章
5_test.md

主题配置文件【我将yml文件改成了txt格式的文件,方便上传】
_config.txt

@Candinya Candinya added the 🐛bug Something isn't working label Jan 12, 2022
@Candinya
Copy link
Owner

确实存在问题,经过检查发现是一级标题的链接没有被正确生成导致的,不知道是 hexo 方面的问题还是主题调用 toc 函数时候出现的疏漏;目前追加了一个遇到错误临时解除所有折叠的方案(但体验会下降),暂时比较优雅的缓解办法是将所有的标题降一级(一级标题变二级,二级标题变三级,以此类推)以避开消失的链接。

相关的内容将保持进一步跟进。

image

@wi-gang
Copy link
Author

wi-gang commented Jan 12, 2022

标题降级后好像并不能缓解当前问题,没有任何效果。

@Candinya
Copy link
Owner

标题降级后好像并不能缓解当前问题,没有任何效果。

所有标题都降级了吗,请注意一级标题一个都不可以出现 👀

@wi-gang
Copy link
Author

wi-gang commented Jan 12, 2022

已确认,测试文件所有标题已降级。[吃瓜]
6_test.md

@Candinya
Copy link
Owner

不好意思我忘记 push 了 💦
并且修复了一个新问题,是移动端目录样式在计算的时候没有被排除掉,导致当左侧边栏模式下会定位错误导致失效
可以再试一试了 💦

@wi-gang
Copy link
Author

wi-gang commented Jan 12, 2022

子级标题已显示,但是标题链接还是存在失效。
image

@Candinya
Copy link
Owner

子级标题已显示,但是标题链接还是存在失效。 image

对的,因为出现了没有链接的标题。这些标题都降级了吗?

@wi-gang
Copy link
Author

wi-gang commented Jan 12, 2022

一级标题降级为二级标题,二级标题降级为三级标题.....所有标题都降了一级

@Candinya Candinya pinned this issue Jan 12, 2022
@Candinya Candinya added the help wanted Extra attention is needed label Jan 12, 2022
@Candinya
Copy link
Owner

能否麻烦请问一下您本主题的本地 commit hash (以便确认是否为最新),和您的站点配置文件,以及 hexo 版本号信息(以便执行兼容性检查),方便这边的复现?

@wi-gang
Copy link
Author

wi-gang commented Jan 16, 2022

主题版本:
image

站点版本:
image

站点配置文件:
_config.txt

@Candinya
Copy link
Owner

您好,我指的是主题的 commit hash ,您可在主题目录下运行 git log 查看,当前最新的 commit hash 应为 26e71c6 。如果您的本地结果不是这个,请考虑使用 git pull 等命令拉取最新的提交,以便测试提交而尚未发布的修复尝试。
image

@wi-gang
Copy link
Author

wi-gang commented Jan 16, 2022

image

@Candinya
Copy link
Owner

在主题更新后,您使用 hexo clean 清理本地缓存文件了吗

@wi-gang
Copy link
Author

wi-gang commented Jan 23, 2022

我不知道咋个回事,我这边现在没有问题了

@Candinya
Copy link
Owner

可能是缓存原因,没有问题了就好,非常感谢您的反馈和帮助 🎉

@Candinya Candinya removed the help wanted Extra attention is needed label Jan 23, 2022
@Candinya Candinya unpinned this issue Mar 20, 2022
@qwx
Copy link

qwx commented Aug 4, 2022

为了后续人查到这个问题不知道该怎么做,这里留一个问题排查过程:
Hexo渲染markdown的时候,header的id是由渲染引擎处理的,当你使用hexo-renderer-markdown-it这个引擎时,默认是2级及以上的层级目录生成ID,可以通过config配置,具体看渲染引擎仓库,但是我看默认引擎应该是会无视这一条规则。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants