in Web & Tech

Bolt CMS: Configure AllowedContent markup for CKEditor

If you’re looking for an awesome, leightweight and performant CMS that supports custom content types, Twig-based templates and, best of all, stores its entire configuration nicely in YML files consider looking at Bolt CMS.

Chances are, you might not like it’s WYSIWYG editor’s (which is CKEditor) default behaviour of not stripping any markup you paste into it.

You don’t have to start fiddling around with CKEditor’s configuration itself. Just head over to Bolt’s config.yml an look for the wysiwyg part.

The interesting part is allowedContent. This gives CKEditors Advanced Content Filter instructions about the allowed and disallowed markup.

Here’s my configuration:

  images: true
  anchor: false
  tables: true
  fontcolor: false
  align: false
  subsuper: false
  embed: true
    allowedContent: 'p i(*); strong em strike cite blockquote code ul ol li dl dt dd br h2 h3 h4 h5;a[!href,title];img[!src,width,height,alt,title]{width,height,text-align,float};table thead tbody tr th td[*]{*}(*)'
    autoParagraph: true # If set to 'true', any pasted content is wrapped in <p> tags for multiple line-breaks

For the syntax of the Allowed Content Filter please refer my other post on CKEditor filtering within Drupal or head over to the official CKEditor docs

Write a Comment