go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.01k stars 5.4k forks source link

YAML frontmatter rendered improperly #5377

Closed mcnesium closed 4 years ago

mcnesium commented 5 years ago

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

stale[bot] commented 5 years ago

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.

mcnesium commented 5 years ago

refresh/unstale

ghost commented 4 years ago

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

dakira commented 4 years ago

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?

davidsvantesson commented 4 years ago

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

dakira commented 4 years ago

@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.

zeripath commented 4 years ago

@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.