@7polo/editorjs-code 中文文档教程
Code
Editor.js 2.0 的代码工具,带有语言选择器、与 PrismJs 语言代码兼容的主题选择器
Feature
- Line Number ✌️
- theme selector
- language selector
Usage
添加一个新的工具到 tools
Editor.js 初始配置的属性。
npm i @7polo/editorjs-code
var editor = EditorJS({
...
tools: {
...
code: {
class: Code,
config: {
plugins:{ // PrismJs plugins
'autolinker': {
css: `https://cdn.jsdelivr.net/npm/prismjs@1.25.0/plugins/autolinker/prism-autolinker.css`,
js: `https://cdn.jsdelivr.net/npm/prismjs@1.25.0/plugins/autolinker/prism-autolinker.min.js`
}
}
}
}
}
});
Config Params
还没有配置!
Output data
此工具返回代码。
{
"type" : "code",
"data" : {
"code": "body {\n font-size: 14px;\n line-height: 16px;\n}",
"language": "css",
"theme": "tomorrow"
}
}
Code
Code Tool for Editor.js 2.0 with language selector、theme selector compatible with PrismJs Language Codes
Feature
- Line Number ✌️
- theme selector
- language selector
Usage
Add a new Tool to the tools
property of the Editor.js initial config.
npm i @7polo/editorjs-code
var editor = EditorJS({
...
tools: {
...
code: {
class: Code,
config: {
plugins:{ // PrismJs plugins
'autolinker': {
css: `https://cdn.jsdelivr.net/npm/prismjs@1.25.0/plugins/autolinker/prism-autolinker.css`,
js: `https://cdn.jsdelivr.net/npm/prismjs@1.25.0/plugins/autolinker/prism-autolinker.min.js`
}
}
}
}
}
});
Config Params
no configuration yet!
Output data
This Tool returns code.
{
"type" : "code",
"data" : {
"code": "body {\n font-size: 14px;\n line-height: 16px;\n}",
"language": "css",
"theme": "tomorrow"
}
}
更多
你可能也喜欢
- 1_lesson_hexlet_js_paladin 中文文档教程
- 4lib_component 中文文档教程
- @0yi0/ethereumjs-vm 中文文档教程
- @2003scape/rsc-config 中文文档教程
- @3b4b/project-two 中文文档教程
- @3scarecrow/number-chinese-transformer 中文文档教程
- @4geit/rct-chatbox-list-component 中文文档教程
- @4geit/rct-common-store 中文文档教程
- @5amcode/sunrise-components 中文文档教程
- @7rabbit/ink 中文文档教程