This package implements code block support for CKEditor 5.
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>
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.