Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

No Markup

Security covered Under active development 4,412 sites

The No Markup module allows you to map component library Twig templates to your field data by removing unnecessary markup. This ensures that your field values are clean and secure, avoiding issues with double rendering or direct un-sanitized data access.

This module aims to help integration with component libraries. Map the Twig templates in your component library to the field data, without the field markup.

Consider the following integration of a content type with the 10f component:

{% embed '@components/06-module-f/10-10f/10f.twig' with {
  node_id: node.id,
  headline: content.field_band_headline,
  subhead: content.field_band_subheader,
  promos: content.field_band_promo_ref|children,
} %}

  {% block component %}
    {{ promo }}
  {% endblock %}

{% endembed %}

The template 10f.twig expects headline and subhead to be the editorial data... but they contain markup.

Usage

Use No Markup to remove all the cruft without weakening your security.

Edit the display mode and Remove field markup for field_band_headline and field_band_subheader. After this the Twig variable content.field_band_headline will only contain the field value, without the wrapping markup. Just the field formatter HTML: plain string for text fields, <a> tag for link fields, ...

Why not striptags/raw instead?

Without this module one can use:

  headline: content.field_band_headline|render|striptags|trim,

This is problematic due to the double rendering involved. So if the headline were Foos&Bars for example, it would render as Foos&amp;Bars.

Another alternative is using the field data directly from Twig.

  headline: node.field_band_headline['#items'][0].value

This can lead to security problems as the user input data is not properly sanitized by the input filters in the render pipeline.

Drupal 9–11

Ask your assistant about No Markup

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

1 tracked project depends on this one

Activity

Tracked releases
5
Tracked since
Jun 2023
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Release Timeline

Releases

Version Type Core PHP Release date
1.0.6 Stable 9–11 Oct 26, 2024
1.0.5 Stable 9–10 Feb 24, 2024
1.0.4 Stable 9–10 Nov 22, 2023
1.0.3 Stable 9–10 Aug 4, 2023
1.0.2 Stable 9–10 Jun 12, 2023