Convert line breaks into HTML does not convert "\n"

Created on 3 February 2025, 11 days ago

Problem/Motivation

The views field rewrite option "Convert line breaks into HTML" does not rewrite "\n" to "
" as described here:
https://www.drupal.org/docs/8/core/modules/views/rewrite-the-output-of-a...

Convert newlines to HTML
tags If this option is enabled, all newline characters (e.g. \n) are converted into break tags.

This may in fact be a bug with the filter module, not views (see _filter_autop()).

Steps to reproduce

  1. Edit any entity that has a field that uses text formats.
  2. Ensure the value of the field contains "\n", for example: "Contributor,\n Foundation Contributor,\n Support".
  3. Create a view of the entity field.
  4. Enable "Convert line breaks into HTML" under rewrite options.
  5. Save the view or look at the preview.
  6. Notice the field renders without converting "\n" to "
    ". For example it simply renders: "Contributor,\n Foundation Contributor,\n Support".

Proposed resolution

Make the rewrite option do what it is documented as doing.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.1 🔥

Component

views.module

Created by

🇺🇸United States maskedjellybean Portland, OR

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024