For a static notice, first confirm that the editor stores the intended snippet. That separates missing content from a preview setting.
Start with a fragment whose result is obvious
This illustrative snippet should display a heading and a short notice when rendered in an environment that allows these elements:
<aside>
<h2>Library collection desk</h2>
<p>Collect reserved books before 5 p.m. on Friday.</p>
</aside>
Use a fragment, rather than pasting an entire document with its own html, head, and body elements into this notice. Keep a copy of the source so you can compare it with the saved value.
In an existing CKEditor 5 setup, add HtmlEmbed to the installed plugins and htmlEmbed to the toolbar. The feature also exposes this insertion command:
editor.execute('htmlEmbed', '<aside><h2>Library collection desk</h2><p>Collect reserved books before 5 p.m. on Friday.</p></aside>');
Run it after editor initialization, with the feature installed. Your existing editor build, imports, and license configuration still apply; the line above is not a complete installation.
Treat the source, preview, and published page separately
The embed keeps a raw snippet as a widget. It does not make every element inside the snippet editable with the ordinary rich-text toolbar. If authors need supported paragraphs and headings that they can format directly, choose the editor features that model that content instead.
For a missing preview, inspect the widget's source first. If the notice exists there, enabling preview may be the missing configuration step. If the saved data lacks the notice, investigate insertion or serialization before changing preview settings.
This differs from a general rich-text editing workflow, where authors format supported content through the editor's document model.
Sanitize before enabling preview
CKEditor allows a sanitizer callback through htmlEmbed.sanitizeHtml. The callback returns sanitized HTML and whether it changed the input. Configure an established sanitizer according to the elements and attributes your application permits before setting showPreviews: true.
CKEditor's documentation warns that disabling execution of script tags does not remove all executable HTML: event-handler attributes can still be dangerous. Preview sanitization and validation at your application's publication boundary need their own treatment. Do not use a function that merely returns the original input as your sanitizer. Preview configuration and security
For the notice, check that your policy preserves the heading and text. If it strips a wrapper, decide whether that changes the intended result. A script-dependent external widget needs a different check because an editor preview can differ from the published page.
Finally, save the document through your CMS, reopen it, and inspect the real publication renderer in a permitted preview. Confirm that “before 5 p.m. on Friday” remains visible and that the notice appears in the right place before publishing.