-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
TOC points to the wrong location #1101
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
Comments
Yea, I think you are right. I have checked Mermaid's documentation and there does not seems to be an API which allows us to execute code after diagram has been rendered. I would say that we can use Adding the following lines at the end of const resizeObserver = new ResizeObserver(entries => resizeHandler);
resizeObserver.observe(document.querySelector(".article-content")); |
I tried 42jerrykim/hugo-stack-mermaid-test@b83e1db and the problem still exists. |
I succeeded in fixing the issue and created a PR, please confirm so I can merge it. |
What happened?
I referred to [Hugo's documentation on diagrams](https://gohugo.io/content-management/diagrams/) to create a Mermaid diagram, but an issue has occurred where the TOC points to the wrong location.
It seems the problem arises because the TOC is processed first, and then the Mermaid diagram is rendered, causing the length of the content to change.
If you visit [this link](https://42jerrykim.github.io/hugo-stack-mermaid-test/p/linux-rcu%EB%9E%80-%EB%AC%B4%EC%97%87%EC%9D%B8%EA%B0%80/#rcu_read_lock), you'll see that after the Mermaid diagram is rendered, the TOC incorrectly points to
synchronize_rcu()
.Hugo version
0.123.8
Theme version
v3.29.0
What browsers are you seeing the problem on?
No response
More information about the browser
No response
Relevant log output
No response
Link to Minimal Reproducible Example
https://github.com/42jerrykim/hugo-stack-mermaid-test
The text was updated successfully, but these errors were encountered: