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

Comment in yaml-codeblock won't generate html #13152

Closed
hmaier-dev opened this issue Dec 15, 2024 · 6 comments · Fixed by #13153
Closed

Comment in yaml-codeblock won't generate html #13152

hmaier-dev opened this issue Dec 15, 2024 · 6 comments · Fixed by #13153

Comments

@hmaier-dev
Copy link

hmaier-dev commented Dec 15, 2024

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

$ hugo version
hugo v0.139.4+extended linux/amd64 BuildDate=unknown

Does this issue reproduce with the latest release?

Yes, it does.

When using the string:

# more publishable markdown files...

in a yaml-codeblock, like this

      - name: Copy over new files
        run: |
            # Whitelist of all publishable wiki articles
            cp index.md $content
            # more publishable markdown files...

instead of the block an e> gets generated. When removing the comment, everything works fine. I also tried different strings with which, it sometimes worked and sometimes not. I cannot guess pattern, when the error occurs.

Also there is no special output when building the site. I guess there is something wrong with goldmark but I do not fully understand how hugo uses goldmark. So I'm approaching you guys at first.

Thanks for your time. I would be happy to provide more information on this issue.

@bep
Copy link
Member

bep commented Dec 15, 2024

in a yaml-codeblock, like this

What exactly do you mean by this.

@bep bep added this to the v0.140.0 milestone Dec 15, 2024
@hmaier-dev
Copy link
Author

I mean it like this:

Some text explaining the yaml
```yaml
      - name: Copy over new files
        run: |
            # Whitelist of all publishable wiki articles
            cp index.md $content
            # more publishable markdown files...
```

When building this, I just get

<p>Some text explaining the yaml</p>
e>

@bep
Copy link
Member

bep commented Dec 15, 2024

I tried your example, and it renders fine for me (I tested with both markup.higlight.codeFences true and false).

@jmooring
Copy link
Member

jmooring commented Dec 15, 2024

I looked at the relevant page in your repository:
https://github.com/hmaier-dev/wiki/blob/main/content/Github.md

The first line of the file is:

# How this wiki works

So, despite the .md extension, Hugo treats this as Emacs Org Mode front matter:

case r == '#':
return lexFrontMatterOrgMode

And when we call lexFrontMatterOrgMode...

l.summaryDivider = summaryDividerOrg

And summaryDividerOrg is...

summaryDividerOrg = []byte("# more")

More about summary dividers here:
https://gohugo.io/content-management/summaries/#manual-summary

A simple example that reproduces the behavior you are seeing:

# a

```yaml
x: 6
# more foo
y: 7
```

Looking at your repository, you need to:

  1. Add YAML, TOML, or JSON front matter to every markdown file
  2. Rename content/index.md to content/_index.md

@hmaier-dev
Copy link
Author

Thanks for your detailed answer, @jmooring. It is very helpful!

Copy link

github-actions bot commented Jan 7, 2025

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants