1. 5
Insert <pre> element
55 (1 vote)
44336 downloads insertpre
  • Add to my editor
  • Download


    The recommended way to install all CKEditor add-ons is to create a custom build by using CKBuilder. To do that, click the Add to my editor button on the plugin page. When you are done, click the Build my editor button on the right side of the page to go to CKBuilder.

    Add-on Installation Instructions

    If you want to add the plugin manually, you will need to:

    1. Extract the downloaded plugin .zip into the plugins folder of your CKEditor installation. Example:
    2. Enable the plugin by using the extraPlugins configuration setting. Example:
      config.extraPlugins = 'insertpre';
    3. Download and configure all its dependencies, too.

    Add-on Dependencies

    Note: The plugin may have additional requirements. Check the add-on page and documentation for more details.

Insert <pre> element

This plugin makes it easier to insert a <pre> tag in CKEditor.


1. Download the plugin and unpack it in the plugins folder

2. Enable the "insertpre" plugin in the CKEditor configuration file (config.js):

config.extraPlugins = 'insertpre';

That's all. "InsertPre" button will appear on the editor toolbar and will be ready to use.

Optionally, you may specify which class should be added to the <pre> element:

CKEDITOR.config.insertpre_class = 'prettyprint';

As well as specify how the <pre> tag should be rendered inside CKEditor:

CKEDITOR.config.insertpre_style = 'background-color:#F8F8F8;border:1px solid #DDD;padding:10px;';


Plugin versions CKEditor versions
4.5 4.4 4.3 4.2 4.1 4.0

Version: 1.1 - Download

Show notes

First version compatible with CKEditor 4.1 and Advanced Content Filter.

unknown compatibilityunknown compatibilityunknown compatibilityunknown compatibilitycompatiblecompatible

Version: 1.0.1 - Download

Show notes

Fixed ugly JS error. Upgrading is recommended.

unknown compatibilityunknown compatibilityunknown compatibilityunknown compatibilityunknown compatibilitycompatible


  • carousel
  • carousel
  • carousel
Log in to rate this plugin


Post a comment
  1. The content of this field is kept private and will not be shown publicly.
  2. *  Required fields
  1. Don't forget to use htmlspecialchars() when populating the CKEditor:
    <textarea><?= htmlspecialchars($my_html_pasted_in_pretags;) ?></textarea>

    Otherwise the correctly encoded html-markup inside your pre-tags

    &lt;!-- code example --&gt;
    &lt;p&gt;This is a html paragraph&lt;/p&gt;</pre>

    will appear as real html-markup outside the pre-tags

    <!-- code example -->
    <p>This is a html paragraph</p>