"Filtered HTML" text format does not support manual teaser break (<!--break-->)

Created on 2 December 2018, over 6 years ago
Updated 17 February 2023, about 2 years ago

Placing the following line inside a story node's body (I guess it also works for other content types) adds a manual teaser break:

<!--break-->

This works fine when the story uses the "Full HTML" text format. It stops working, however, when I switch the story's text format to "Filtered HTML". I expect manual teaser breaks to work with any text format, if not out of the box then at least by configuring the text format in some way (e.g. by modifying the text format's set of allowed HTML tags).

A similar issue already exists for Drupal 7, but In Drupal 7 a workaround exists because it's possible to add <!--> to the "Filtered HTML" text format's set of allowed HTML tags (cf. comment 118 of the other issue).

The same workaround does not work for Drupal 8 because in Drupal 8 "Filtered HTML" treats the set of allowed HTML tags as DOM elements (cf. implementation of the function FilterHtml::getHtmlRestrictions()), but the manual teaser break is a HTML comment.

🐛 Bug report
Status

Needs review

Version

10.1

Component
Filter 

Last updated about 2 hours ago

No maintainer
Created by

🇨🇭Switzerland herzbube

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • 🇺🇸United States alison

    Rebased; tests are running.

    I wonder if we should update the issue title and description to "Basic HTML" instead of "Filtered HTML", based on what comes with recent versions of Drupal?

    -------
    Meanwhile, I tried to review the changes in DrupalPod, so far, I don't seem to be able to add <!-- break --> to a WYSIWYG-enabled text area and have it be preserved, but I might be testing wrong -- am I meant to create a text format called filtered_html?

    The only config change I tried so far was to add <!-- break --> to editor[settings][plugins][ckeditor5_sourceEditing][allowed_tags], but this change didn't "stick" (when I went back into the basic_html config form, the break tag wasn't there anymore). ANYWAY, I'm probably just not testing right -- maybe worth adding test instructions to the issue summary?

  • Status changed to Needs work about 2 years ago
  • 🇺🇸United States smustgrave

    Self review.

    Will have to retake a look at this. Title could be updated and something may have to be tweaked as it longer appears to be working. Could use an issue summary update.

  • 🇨🇭Switzerland stefanos.petrakis@gmail.com Biel, Switzerland

    Regarding #52: The provided solution is only effective for non-WYSIWYG editing. CKEditor 5 is by default removing any html comments so the reported issue will be caused by the editor and not Drupal's text formats. More on this here =>
    https://ckeditor.com/docs/ckeditor5/latest/features/general-html-support...
    That being said, if you would pick e.g. the RestrictedHTML format when editing which doesn't use an editor, you could test the provided solution.

    In general, even if a solution is presented for CKEditor (e.g. sth similar to https://ckeditor.com/docs/ckeditor5/latest/features/html-embed.html), the existing solution will still be necessary to tackle this issue.

    This issue may need to change into a task, e.g. "Support manual summary delimiter breaks", where 2 problems will be addressed:

    1. FilterHTML's support for the delimiter (already has a solution)
    2. CKEditor5's support for the delimiter (as in a CKEditor Plugin that would preserve this html comment). That was also suggested in #40
  • 🇩🇰Denmark ressa Copenhagen

    @alison: It's <!--break-->, not <!-- break -->. I tried both, and only <!--break--> works :)

    I can confirm that the "Full HTML" text format cuts off the text after <!--break-->, both in node display, as well as in a view.

  • 🇩🇰Denmark ressa Copenhagen

    I wonder if we should update the issue title and description to "Basic HTML" instead of "Filtered HTML", based on what comes with recent versions of Drupal?

    Great idea, I updated to that.

  • For those upgrading from older versions of Drupal, it is also true that it doesn't work for "Filtered HTML" either.

    Is this issue still being worked on? The last update re code is from a year ago, and I do not see any issue regarding the CKE5 issue mentioned in #56.

  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Gábor Hojtsy made their first commit to this issue’s fork.

  • 🇭🇺Hungary Gábor Hojtsy Hungary

    I think its fine to fix the backend processing in this issue and solve the CKEditor problem in another issue. I changed the target branch of the MR to 11.x where it should be, but there are conflicts that need resolving. Hope someone can pick that up? :) In general I think the diff looks reasonable BTW.

  • 🇭🇺Hungary Gábor Hojtsy Hungary

    BTW https://www.drupal.org/project/ckeditor_drupalbreaks is a contributed project that provides a UI to add the break as well as a filter to preserve the break.

  • Assigned to Anita verma
  • 🇨🇦Canada phjou Vancouver 🇨🇦 🇪🇺

    Just discovered that the site I was using had that patch and broke the upgrade when switching to Ckeditor5. AFter removing the patch it was working, but I guess I lose the feature.
    Thanks @Gabor for the suggestion of the module, it already installed on my site, I'll try the new branch.
    Do you know if we need the patch + the module or is the module enough?

  • First commit to issue fork.
  • Merge request !11460Apply changes from MR 3106 → (Open) created by Harlor
  • Pipeline finished with Failed
    about 24 hours ago
    Total: 113s
    #447369
  • Pipeline finished with Failed
    about 17 hours ago
    Total: 154s
    #447799
  • Pipeline finished with Failed
    about 17 hours ago
    Total: 160s
    #447803
  • Pipeline finished with Failed
    about 16 hours ago
    Total: 801s
    #447810
  • 🇩🇪Germany Harlor Berlin

    I created a new MR based on 11.x with the diff from MR 3106.

  • 🇩🇪Germany Harlor Berlin

    I'm not sure if the test failures have anything todo with the changes in this issue. I hope someone finds time to find this out.

Production build 0.71.5 2024