Skip to content
No description, website, or topics provided.
JavaScript CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lang
src
theme
.eslintrc.js
.gitattributes
.gitignore
LICENSE.md
README.md
package.json

README.md

CKEditor 5 code block feature

npm version

This package implements code block support for CKEditor 5.

See https://github.com/ckeditor/ckeditor5/issues/436

Usage

In ckeditor5-build-classic project:

npm install https://github.com/Yeolar/ckeditor5-code-block

Update src/ckeditor.js with:

import CodeBlock from '@Yeolar/ckeditor5-code-block/src/codeblock';

ClassicEditor.builtinPlugins = [
  // ...
  CodeBlock
];

ClassicEditor.defaultConfig = {
  toolbar: {
    items: [
      // ...
      'blockQuote',
      // ...
    ]
  },
};

Then

npm run build

In your templates, add (depends highlight.js):

<script src="/static/highlight/highlight.min.js"></script>
<link rel="stylesheet" type="text/css" href="/static/highlight/styles/default.css" />
<script>
$(document).ready(function() {
    $('pre p').each(function(i, block) {  // use <pre><p>
      hljs.highlightBlock(block);
    });
});
</script>

License

Licensed under the terms of GNU General Public License Version 2 or later. For full details about the license, please check the LICENSE.md file.

You can’t perform that action at this time.