1.0.7 • Published 7 months ago

@nuxtizen/editorjs-shiki v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Code Tool for Editor.js with Shiki the syntax higlighter

Code Tool for the Editor.js using Shiki for syntax higlighting.

Demo

npm.io

Installation

Install the package

pnpm add @nuxtizen/editorjs-shiki

Usage

Include plugin in your application.

import CodeShiki from '@nuxtizen/editorjs-shiki';

Add to the tools property of the Editor.js configuration.

const editor = EditorJS({
  ...
  tools: {
    code: CodeShiki
  }

  ...
});

You can set the language and theme for the code block.

const editor = new EditorJS({
  ...

  tools: {
    ...
    code: {
      class: CodeShiki,
      config: {
        lang: 'typescript',
        theme: 'dracula',
      }
    }
  }

  ...
});

You can find all available languages in the Shiki Languages and themes in the Shiki Themes.

Config Params

FieldTypeDescription
placeholderstringCode Tool's placeholder string
langstringDefault selected language
themestringDefault selected theme

Output data

Example block output data:

{
    "type": "code",
    "data": {
      "code": "import defaultAnimal, { person, add } from './module.js';\nimport * as Module from './module.js';",
      "lang": "javascript",
      "theme": "dracula"
    },
}
1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago