Open exprez135 opened 4 years ago
Related support thread I opened on the forum: https://discourse.gohugo.io/t/requesting-help/9132.
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master
branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
Please re-open.
To reproduce:
git clone --single-branch -b hugo-github-issue-7128 https://github.com/jmooring/hugo-testing hugo-github-issue-7128
cd hugo-github-issue-7128
hugo server
Contrary to the original report, the following does not resolve the problem:
[markup.tableOfContents]
endLevel = 3
ordered = false
startLevel = 2
Related: https://discourse.gohugo.io/t/24460
Please re-open.
One possible workaround for this is using CSS
For me, this is how it looked like earlier
I applied the following CSS rules
.table-of-contents ul {
padding-inline-start: 0;
list-style: none;
}
.table-of-contents ul:has(> li > a) {
padding-inline-start: 40px;
list-style: disc;
}
This resulted in the following output
This retains the nesting, but at the same time, hides the bullets for empty lists
For anyone running into similar ToC issues, I wrote a template library that generates a ToC. https://github.com/jerrychan7/hugoPerfectToC This project can correctly generate the table of contents, but the disadvantage is that the performance is relatively poor. Since the project parses HTML, it can theoretically parse any extension correctly (#12605). Or work with the heading rendering hook.
Comparison between the directory generated by Hugo and the directory generated by my project:
PAGE.TableOfContents |
ToC generated by my project |
---|---|
|
|
What version of Hugo are you using (
hugo version
)?v0.68.3 on macOS via HomeBrew
Does this issue reproduce with the latest release?
Yes.
Whenever I enable the Table Of Contents in a situation without any
endLevel
specified in the site configuration:The Table of Contents comes out looking like this:
I believe the expected behaviour would be for no extra bullet point to appear (or to appear with the H4).
If I add an H3:
Work-Around
If I manually set an
endLevel
, the problem disappears. It is only when one is not set that the problems occur.