JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1207
  • Score
    100M100P100Q121094F
  • License ISC

Code syntax highlighting tool for Editor.js

Package Exports

  • @bomdi/codebox

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@bomdi/codebox) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

CodeBox

Code syntax highlighting tool for Editor.js

Installation

Install via NPM

npm i --save-dev @bomdi/codebox

Add to your module/application

const CodeBox = require('@bomdi/codebox');

Usage

Add CodeBox tools property of the CodeX Editor initial config.

var editor = CodexEditor({
  ...

  tools: {
    ...
    codeBox: CodeBox,
  }

  ...
});

Config Params

All parameters are optional

Field Type Description
themeURL string URL pointing to CSS file that can be used by highlight.js. This could also point o your own custom CSS syntax file. If themeURL is provided, themeName and useDefaultTheme will be ignored
themeName string Any one of the accepted theme names used by highlight.js. Only the name is required, not the full URL (example "a11y-dark"). If themeName is provided, useDefaultTheme will be ignored
useDefaultTheme string CodeBox has 2 default themes - 1 light and 1 dark. You can specify what default should be applied by passing the string 'light' or 'dark' to this parameter. Note that setting themeURL or themeName overrides this setting

If no parameters are specified, CodeBox defaults to a dark theme.

Output data

CodeBox returns the following data

{
  "type": "codeBox",
  "data": {
    "code": "consttest = newTest();.codeBoxTextArea{\n  width: 100%;\n  min-height: 30px;\n  padding: 10px;\n  border-radius: 2px 2px 2px 0;\n  border: none !important;\n  outline: none !important;\n  font: 14px monospace;\n}\n\n.codeBoxSelectDiv{\n  display: flex;\n  flex-direction: column;\n  justify-content: flex-start;\n  align-items: flex-start;\n  position: relative;\n}",
    "language": "css"
  }
}

Author

Adombang Munang Mbomndih (Bomdi)

LinkedIn: LinkedIn