hugo icon indicating copy to clipboard operation
hugo copied to clipboard

Goldmark passthrough LaTeX expressions not correctly reflected in .TableOfContents

Open DanilaFe opened this issue 9 months ago • 2 comments

It's been really exciting to see support for Mathematics in Makdown. I've had to spend years double-escaping my LaTeX expressions. Now, I'm eager to make the switch, but noticing a bug that will make the migration incomplete.

In my Markdown source, I have the following:

#### Aside: Vectors and Finite \(\mathbb{N}\)
Screenshot 2024-05-13 at 4 51 26 PM

This is great, but upon reviewing the diffs in terms of generated HTML, I noticed that following diff in the table of contents:

<         <li><a href="#aside-vectors-and-finite-mathbbn">Aside: Vectors and Finite \(\mathbb{N}\)</a></li>
---
>         <li><a href="#aside-vectors-and-finite-mathbbn">Aside: Vectors and Finite </a></li>

This is a change from what I had originally, which was double-escaped:

#### Aside: Vectors and Finite \\(\\mathbb{N}\\)

So, it seems that the Goldmark passthrough content isn't displayed in the auto-generated table of contents.

If it helps, my configuration for markup is as follows:

[markup]
  [markup.tableOfContents]
    endLevel = 4
    ordered = false
    startLevel = 3
  [markup.goldmark]
    [markup.goldmark.extensions]
      [markup.goldmark.extensions.passthrough]
        enable = true
        [markup.goldmark.extensions.passthrough.delimiters]
          block = [['\[', '\]'], ['$$', '$$']]
          inline = [['\(', '\)']]

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.125.7+extended darwin/arm64 BuildDate=2024-05-08T14:46:24Z VendorInfo=brew

Does this issue reproduce with the latest release?

Yup.

DanilaFe avatar May 13 '24 23:05 DanilaFe