getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.27k stars 167 forks source link

Issue rendering markdown in blocks within a structure #3831

Closed viciouskitten closed 2 years ago

viciouskitten commented 2 years ago

Describe the bug
I am using blocks within a structure. All of the other types of block seem to be working fine but when i use the Markdown block it’s not rendering correctly.

This is how the .yml file is saving my markdown. It seems to be adding quotes around it documentation: '[{"content":{"text":"# An H1 Header\n## An H2 Header\n### An H3 Header\n#### An H4 Header"},"id":"d99269ab-21a5-4d21-94e7-7e9ff838238b","isHidden":false,"type":"markdown"}]'

If i change it to this in the .yml file it works fine: documentation: | [{"content":{"text":"# An H1 Header\n## An H2 Header\n### An H3 Header\n#### An H4 Header"},"id":"d99269ab-21a5-4d21-94e7-7e9ff838238b","isHidden":false,"type":"markdown"}]

To Reproduce
Steps to reproduce the behavior:

  1. In a .yml file create a 'structure' field
  2. Nested within the structure field create a 'blocks' field
  3. Go into the panel and add a structure and a markdown block within that
  4. When you view the page in the browser the markdown isn't rendering correctly

Expected behavior
For markdown to be rendered correctly in the browser

Screenshots
How the panel looks with the markdown code:

Screenshot 2021-10-20 at 20 41 30

How it looks:

Screenshot 2021-10-20 at 22 27 23

How it should look:

Screenshot 2021-10-20 at 22 39 39

Kirby Version
3.5.7.1

Console output
No errors

Desktop (please complete the following information):

bastianallgeier commented 2 years ago

Thanks for the detailed issue report. This is an issue with the yaml parser. We are already planning a fix for this by switching to JSON for structure fields. I'm afraid I cannot offer a good fix for this in the meantime.

afbora commented 2 years ago

I'm closing this for now. We have a ticket connected to this issue in the backlog and we will follow up 🧐

viciouskitten commented 2 years ago

Thank you!