hugo-PaperMod icon indicating copy to clipboard operation
hugo-PaperMod copied to clipboard

[BUG] Unable to render TOC in org-mode files

Open pace577 opened this issue 2 years ago • 2 comments
trafficstars

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:

  1. Create an org file with hugo new post.org with at least one heading (Eg: * Heading )
  2. Add ShowToc: true in the front matter of post.
  3. Serve the site with hugo serve -D.
  4. 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!

pace577 avatar Jan 05 '23 19:01 pace577

I haven't tested this on org files. Using markdown is recommended with PaperMod

adityatelange avatar Dec 23 '23 18:12 adityatelange