Skip to content

Yeolar/ckeditor5-code-block

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CKEditor 5 code block feature

npm version

This package implements code block support for CKEditor 5.

See ckeditor/ckeditor5#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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published