Edit on GitHub
Jump to docs navigation

Field Types / Markdown field

Note: You are currently reading the documentation for Bolt 3.7. Looking for the documentation for Bolt 5.2 instead?

A markdown field. This gives you a markdown editor with a preview window.

You can read more about markdown here.

Basic Configuration:

        content:
            type: markdown

Example usage in templates:

A markdown fields contents need to be converted to html before using in templates. You do this with the |markdown filter in twig, like this:

{{ record.content|markdown }}

Input Sanitisation

All content in this field type will be sanitised before it gets inserted into the database. This means that only 'whitelisted' HTML like <b> and <img src="…"> is kept, while things like <embed> and <script> are scrubbed from the field before being stored. As a site-implementor you can control the whitelisted tags and attributes using the following section in config.yml:

htmlcleaner:
    allowed_tags: [ div, span, p, br, hr, s, u, strong, em, i, b, li, ul, ol, …, … ]
    allowed_attributes: [ id, class, style, name, value, href, src, alt, title, …, … ]

By design, you can not disable the sanitation entirely. If you need to allow the editors to insert unfiltered HTML or javascript, use a type: textarea field instead.



Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.