Textarea editor called in YAML not processing markdown

Hi,

Created a template and respective yaml:

title: Text
'@extends': default

form:
  fields:
    tabs:
      fields:
        content:
          fields:
            header.media_order:
              label: Page Media (first one will be displayed next to your content)
            header.image_align:
              type: select
              label: Image position
              classes: fancy
              default: left
              options:
                'left': 'Left'
                'right': 'Right'
        features:
          type: tab
          title: '+ Info'
          fields:
              header.extra_info:
                type: editor
                validate:
                    type: textarea
                label: Info Adicional
                markdown: true

… and called it in twig file: {{ header.extra_info }}

For some reason markdown isn’t being processed.
Am I missing something?

Cheers!
Pedro

Educated guess here …

I don’t think the markdown property here is doing anything except ensuring that when the page is edited or created, its extra_info field is saved as YAML-compatible markdown.

However, I can’t see any docs on this markdown property - where did you find out about it? The editor field type supports markdown natively I thought.

Anyway … when the template comes to use it, it’s not consulting the blueprint to see what type the field should be. Try applying a filter in your template like:

{{ header.extra_info|markdown }}

and the markdown should be processed. I am pretty sure templates are not blueprint-aware.

You are totally right. After adding |markdown to twig, it worked as expected. As for markdown property, I think it was somewhere in admin plugin, but I’ll have to confirm.

Thank you,
Pedro

It’s probably good that Twig is ignorant by default of blueprints and form field types:

  • template designers should be considering this anyway and it makes the templates more self-documenting
  • it provides more flexibility.

Having said that, I hacked the data manager plugin recently to enable specifying output formats for fields and I’m thinking of adding my change as a pull request. My use case was formatting a datetime field that I wanted to store as UTC, which is obviously not very readable.

Cheers