YAML frontmatter rendered improperly #2558

Closed
opened 2025-11-02 04:40:24 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @mcnesium on GitHub (Nov 22, 2018).

Exemplary, in a Jekyll project, markdown files have a YAML front matter like this default one in index.md:

---
# Feel free to add content and custom Front Matter to this file.
# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults

layout: default
---

Gitea tries to render it as if it was regular Markdown:

screenshot from 2018-11-22 10-28-41

Instead, it should detect it being the YAML frontmatter and render it properly, e.g. like this (screenshot created by adding four spaces in front of each line in the front matter):

screenshot from 2018-11-22 10-30-03

Originally created by @mcnesium on GitHub (Nov 22, 2018). Exemplary, in a Jekyll project, markdown files have a YAML front matter like this default one in `index.md`: ```markdown --- # Feel free to add content and custom Front Matter to this file. # To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults layout: default --- ``` Gitea tries to render it as if it was regular Markdown: ![screenshot from 2018-11-22 10-28-41](https://user-images.githubusercontent.com/476060/48894061-12796d00-ee42-11e8-8473-e560b6d8e576.png) Instead, it should detect it being the YAML frontmatter and render it properly, e.g. like this (screenshot created by adding four spaces in front of each line in the front matter): ![screenshot from 2018-11-22 10-30-03](https://user-images.githubusercontent.com/476060/48894032-02618d80-ee42-11e8-8a5b-ddb8e29c7f86.png) - Gitea Version: 4c1f1f9
GiteaMirror added the issue/confirmedtype/enhancement labels 2025-11-02 04:40:24 -06:00
Author
Owner

@stale[bot] commented on GitHub (Jan 21, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Jan 21, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@mcnesium commented on GitHub (Jan 22, 2019):

refresh/unstale

@mcnesium commented on GitHub (Jan 22, 2019): refresh/unstale
Author
Owner

@ghost commented on GitHub (Sep 18, 2019):

There is an open pull request for gogs: https://github.com/gogs/gogs/pull/4643

@ghost commented on GitHub (Sep 18, 2019): There is an open pull request for gogs: https://github.com/gogs/gogs/pull/4643
Author
Owner

@dakira commented on GitHub (Dec 5, 2019):

I have the same problem. Would be nice if the front matter just weren't rendered at all. Edit: I guess this should be implemented on the side of the markdown parser. Which parser is in use by Gitea?

@dakira commented on GitHub (Dec 5, 2019): I have the same problem. Would be nice if the front matter just weren't rendered at all. Edit: I guess this should be implemented on the side of the markdown parser. Which parser is in use by Gitea?
Author
Owner

@davidsvantesson commented on GitHub (Feb 21, 2020):

@zeripath Do you think the change to goldmark makes a difference for this issue, does it have any specific support for it?

@davidsvantesson commented on GitHub (Feb 21, 2020): @zeripath Do you think the change to goldmark makes a difference for this issue, does it have any specific support for it?
Author
Owner

@dakira commented on GitHub (Feb 24, 2020):

@davidsvantesson I haven't checked how it looks now, but Goldmark definitely has support for yaml frontmatter. It is used as the default renderer for Hugo which does also have yaml frontmatter.

@dakira commented on GitHub (Feb 24, 2020): @davidsvantesson I haven't checked how it looks now, but Goldmark definitely has support for yaml frontmatter. It is used as the default renderer for Hugo which does also have yaml frontmatter.
Author
Owner

@zeripath commented on GitHub (Mar 28, 2020):

@davidsvantesson @dakira we would need to use the https://github.com/yuin/goldmark-meta extension.

I guess it would probably be quite easy to do. The issue is deciding whether to always enable it or not.

I mean yaml front matter is a particular extension to commonmark - it may not be expected.

@zeripath commented on GitHub (Mar 28, 2020): @davidsvantesson @dakira we would need to use the https://github.com/yuin/goldmark-meta extension. I guess it would probably be quite easy to do. The issue is deciding whether to always enable it or not. I mean yaml front matter is a particular extension to commonmark - it may not be expected.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2558