Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering Issue caused by <!--more--> #12426

Open
Junyi-99 opened this issue Apr 24, 2024 · 2 comments · May be fixed by #12437
Open

Rendering Issue caused by <!--more--> #12426

Junyi-99 opened this issue Apr 24, 2024 · 2 comments · May be fixed by #12437
Labels
Milestone

Comments

@Junyi-99
Copy link

Hugo will produce a string of e>

Just try this in any of a theme:

---
title: "Demo - Summary Rendering Test 7 (😱 Bad Dream)"
date: 2024-04-25T1:54:18+08:00
draft: false
---

```c {linenos=table}
int main() {
    // Is your theme able to handle this?
    // Are the content below rendered correctly?
    return 0; // Only see this in the summary view
}
```

<!--<!--more-->

<mark>You MUST NOT see me in the preview</mark>

## Test Heading

The content below should also be hidden in the summary view.

<!--more-->

```html
Will <!--<!--more--> cause a rendering issue?
```

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

$ hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended darwin/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=brew

Does this issue reproduce with the latest release?

YES

@Junyi-99 Junyi-99 changed the title Rendering Issue caused by <!--more--> Rendering Issue caused by <!--more--> Apr 24, 2024
@Junyi-99
Copy link
Author

image

@Junyi-99
Copy link
Author

As a rendering engine, Hugo simply uses string.find("<!--more-->") instead of using lexical parsing for <! --, which is a irresponsible behavior, as it makes it not easy for the user to debug.

I suggest that Hugo warns the user that there's a syntax error somewhere instead of just displaying the rendering crashed page. (if possible.)

This PR (#12437) provides a mitigation (since we should put <!--more--> at the beginning of a line)

@bep bep added this to the v0.130.0 milestone Jul 22, 2024
@bep bep removed the NeedsTriage label Jul 22, 2024
@bep bep modified the milestones: v0.130.0, v0.131.0 Jul 30, 2024
@bep bep modified the milestones: v0.131.0, v0.133.0 Aug 9, 2024
@bep bep modified the milestones: v0.133.0, Unscheduled Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants