adityatelange / adityatelange/hugo-PaperMod

[Bug]: Possible typo in TOC regex (`(.|\n])+?`)

Aperta
#1,872 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
HTML
Stelle
13.9k
Fork
3.4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### What happened?

I may be mistaken, but I noticed what looks like a possible typo in layouts/_partials/toc.html.

The current regex is:

(.|\n])+?

It seems that there is an extra ] after \n.

Should it perhaps be:

(.|\n)+?

I noticed this while investigating why headings containing line breaks didn't seem to be matched. If I'm misunderstanding the intent or if this works correctly with Hugo's regex engine, please ignore this.

### Steps to reproduce

### Steps to reproduce

1. Create an Org file with the following content:

```org
#+TITLE: foo
#+showtoc: t

* Content
foo bar
```

2. Start the Hugo server:

```bash
hugo server
```

3. Open the generated page in a browser.

4. Observe that the Table of Contents is not displayed.

### Expected behavior

The page should display a Table of Contents containing the `Content` heading.

### Additional information

While investigating this issue, I noticed the following regex in `layouts/_partials/toc.html`:

```go
(.|\n])+?
```

It appears there may be an extra `]` after `\n`. I'm not sure whether this is intentional or a typo, but I thought it might be related.

### Hugo Version

Hugo >= 0.146.0 (Recommended - Minimum version required for PaperMod)

### PaperMod Version

154d006

### What kind of devices are you seeing the problem on?

Desktop

### What browsers are you seeing the problem on?

Firefox

### Browser Version

_No response_

### Relevant log output

```shell
No relevant log output.
```

### Repository/Source Code link where this issue can be reproduced

_No response_

### Code of Conduct

- [ ] I agree to follow this project's Code of Conduct

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.