Markdown in form label to add page link


I have a similar question to this one:
How can i add anchor link in form label?
The proposed solution was to use HTML, which seems quite ok for an absolute link or an email address, but I’d like to include a relative page link.
As my site is multi language, the easiest option I know of is a markdown relative link, which automatically adds the /cms/en/ part in front of the relative page url (i.e. /legal/privacy).

So, I need either a possibility to “inject” this site base url part including the currently active language to include in an HTML a href tag (then I could use the solution shown in the link above) or, and this I would prefer, I have the option of enabling markdown in form labels.

My file

title: 'Contact form'
published: true
    markdown: true
child_type: default
routable: true
cache_enable: true
visible: true
    name: contact
            name: name
            label: Name
            placeholder: 'Your Name'
            autofocus: 'on'
            autocomplete: 'on'
            type: text
                required: true
            name: email
            label: E-Mail
            placeholder: 'Your eMail address'
            type: email
                required: true
            name: message
            label: Message
            placeholder: 'Your message'
            type: textarea
                required: true
            name: privacyAccepted
            label: 'I consent that this personal data will be processed according to our [privacy notice](/legal/privacy).'
            type: checkbox
            style: 'float: left; margin-top: 6px;'
                required: true
                message: 'Permission to use the given data must be granted!'
            name: privacyDescription
            label: 'You may withdraw this consent at any time via eMail to []('
            type: display
            markdown: true
            content: null
            type: submit
            value: Submit
            type: reset
            value: Reset
                subject: '[ Contact form] {{|e }}'
                body: '{% include ''forms/data.html.twig'' %}'
                fileprefix: contact-
                dateformat: Ymd-His-u
                extension: txt
                body: '{% include ''forms/data.txt.twig'' %}'
            message: ''
            display: thankyou

# Contact form

Please describe your concerns, I will answer as soon as possible.  
Direct contact: [](

Thanks for your help!
Best regards,

1 Like

I think this is a limiation of the current form plugin. Perhaps you can add an issue here:


and commited for next release of forms plugin.


Hi! Not working for me. Instead the “type: display” works. Don’t know why.
This is my code:

        name: agree_to_terms
        type: checkbox
        markdown: true
        label: "<a href='' target='blank'>Accept</a> This is a test of **bold** and _italic_ in a text/display field\n\nanother paragraph...."
            required: true
        name: other_terms
        type: display
        size: normal
        markdown: true
        label: Other terms
        content: "<a href='' target='blank'>Accept!</a> This is a test of **bold** and _italic_ in a text/display field\n\nanother paragraph...."

Tried also to modify checkbox.html.twig file by deleting the escape character for {{ field.label|t|e }} but it changes nothing.

Html output for checkbox label is in commas as seen below:

<label style="display:inline" class="inline" for="agree_to_terms-"> 
   " href='' target='blank'>Accept<a> This is a test of <strong>bold</strong> and <em>italic</em> in a text/display fieldb<br /> <br /> another paragraph.... "
   <span class="required">*</span>

type: checkbox
markdown: true

should be working

Try using markdown remote link in your label

Doesn’t work. I tried with o without every kind of commas but the html is rendered in the FE as it is.


It’s definitely working.(I’m using exactly the same form definition).
You can use simple markdown links in your form label field. No need for HTML links.
When using markdown links don’t use Quotation Marks in your label field!
You have latest form plugin (2.15.0) installed?

I had the same issue and it was happening because the custom theme I made used theme inheritance from Quark (version 1.03). The Quark’s checkbox.html.twig however wasn’t updated yet so that markdown could be enabled for the checkbox. Maybe something similar is going on at your end.

Tried out and doesn’t work. I’m running last version of Grav fully updated with Gantry Helium theme.

This seems to work for me with Forms plugin v2.16.3 for checkboxes. It doesn’t work for the textarea type, though.

I’m having the same issue as Felix with Forms v 3.0.0, Quark Theme modular page. Markdown is enabled in display and description, but not for label of a checkbox field.

1 Like