Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Markdown editor does not insert paragraphs

Started by Muut Archive 9 years ago · 7 replies · 778 views
9 years ago

Hi all,
For a custom input I want to use the markdown editor. It saves the content, but it does not recognize paragraphs in the text and just puts it all after each other as if it's one big string. The default 'content' input does recognize the paragraphs in the text and outputs it in <p></p>. This is the yaml I use in my blueprint:

YAML
header.company_description:
  # type: editor
  type: markdown
  label: Description
  validate:
    type: textarea

I tried both type: editor - as I read in the documentation - and type: markdown - as it is configured in the system's default blueprint (line 30). Is there something I can do to fix this issue?

9 years ago

What works for me in this case is to use the markdown filter in the twig template:

TWIG
{{ header.company_description|markdown }}

Maybe this solves your problem?

👍 1
9 years ago

Thanks for your reply! I will add an issue to github. @benigartenmann it's for an input in the admin, so I need to trigger the markdown editor from the blueprint. Thanks for your advice anyway!

9 years ago

Ah yes. You will need to use the markdown filter as the data is stored in markdown and not in HTML.

9 years ago

The editor field simply provides the code editor. It doesn't actually perform any markdown to HTML processing.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1332 9 years ago
Archive · by Muut Archive, 9 years ago
2 923 9 years ago
Archive · by Muut Archive, 9 years ago
2 4053 9 years ago
Archive · by Muut Archive, 9 years ago
1 2931 9 years ago
Archive · by Muut Archive, 9 years ago
3 1109 9 years ago