hugo-PaperMod
hugo-PaperMod copied to clipboard
[BUG] Unable to render TOC in org-mode files
Describe the bug
When I try to generate the table of contents for a post with the ShowToc: true option, I don't see the TOC on the post as expected.
- Device/Os: Manjaro
- Type: Desktop
- Browser and version: Mozilla Firefox 108.0.1
- Hugo Version [ >=0.83.0 expected]: 0.108.0
- Theme Version [e.g. v4.0, master, or commit-id ]: d3d90be
Steps to reproduce the behavior:
- Create an org file with
hugo new post.orgwith at least one heading (Eg:* Heading) - Add
ShowToc: truein the front matter of post. - Serve the site with
hugo serve -D. - Open the page and see that the TOC is not visible.
However, note that the TOC is displayed if a .md file was made instead of a .org file.
Expected behavior: Table of Contents was supposed to appear as expected.
Additional context
Upon debugging, I found that changing the regexp in this line from <h[1-6].*?>(.|\n])+?</h[1-6]> to <h[1-6].*?>(.|\n)+?</h[1-6]> (removed a ] character in the middle) seems to give expected behaviour.
Making this change locally fixed the bug for me, but I do not understand why it happened!
I haven't tested this on org files. Using markdown is recommended with PaperMod