This a fork of Code Tool for the Editor.js that allows to include code examples along with language codes that are supported by PrismJs in your articles.
The list of languages supported is in languages.txt
- Upload folder
distfrom repository - Add
dist/bundle.jsfile to your page.
You can load latest version of this package from jsDelivr CDN.
https://cdn.jsdelivr.net/gh/paraswaykole/editor-js-code@latest/dist/bundle.js
Require this script on a page with Editor.js.
<script src="..."></script>Add a new Tool to the tools property of the Editor.js initial config.
var editor = EditorJS({
...
tools: {
...
code: CodeTool,
}
...
});| Field | Type | Description |
|---|---|---|
| placeholder | string |
Code Tool's placeholder string |
This Tool returns code.
{
"type" : "code",
"data" : {
"code": "body {\n font-size: 14px;\n line-height: 16px;\n}",
"languageCode": "css"
}
}