Skip to content

[BUG] 文章中的代码块无法展开或折叠 #960

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

Open
yirami opened this issue Mar 22, 2025 · 3 comments
Open

[BUG] 文章中的代码块无法展开或折叠 #960

yirami opened this issue Mar 22, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@yirami
Copy link

yirami commented Mar 22, 2025

Describe the bug 描述你遇到的错误

在生成的文章中无法切换代码块的折叠状态。
但不是所有文章都如此,有些文章正常,通过F12查看不正常的页面其 console 选项卡中有错误。

Expected behavior 期待的行为

期待单击代码块前的箭头标记可以切换折叠状态。

Screenshots 屏幕截图

出错文章
调用栈

Build Environment 构建环境

  • OS: Windows 10, WSL2, Debian 12 docker
  • master d2ca7b3
  • Hugo version v0.145.0-extended

Please try to use Hugo extended version before opening the issue.
请在创建 issue 之前先尝试使用 Hugo extended 版本构建.

Preview Environment 预览环境

  • OS: Windows 10
  • Chrome 133.0.6943.127

Additional Information 补充信息

Configuration files or front matter code...
配置文件或者前置参数的代码...

@yirami yirami added the bug Something isn't working label Mar 22, 2025
@yirami
Copy link
Author

yirami commented Mar 23, 2025

补充两个测试:

  1. 在本地通过 "hugo serve --disableFastRender" 启动服务后,只要在上述有问题的文章稿件中随便做一个修改(如增加一个空行等),会触发网页的更新,此时F12控制台就没那个错误了,且代码块可以正常折叠、展开。
  2. 移除部分草稿也会导致这个问题消失,但目前没有总结出规律。

@yirami
Copy link
Author

yirami commented Apr 1, 2025

补充测试:

  1. 在这篇稿件中设置 "disableFold: false" 可以正常折叠展开,F12控制台也无相关错误输出。

@yirami
Copy link
Author

yirami commented Apr 3, 2025

似乎跟这篇文章中有使用 {{< raw >}}...{{< /raw >}} 有关,把文章中所有相关表述去除后正常。

总之,这个问题似乎很难确认实锤根本原因,我先这么处理吧,难受。

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

1 participant