editorjs-maths

Math Tool for Editor.js

Usage no npm install needed!

<script type="module">
  import editorjsMaths from 'https://cdn.skypack.dev/editorjs-maths';
</script>

README

Math Tool for Editor.js

Math Tool for the Editor.js allows to include math in your articles. You can see it in action here.

Install

Download the package through npm (or yarn)

npm i --save-dev editorjs-maths
yarn add editorjs-maths

and include the package in your app

const MathTool = require('editorjs-maths');
// or import MathTool from 'editorjs-maths';

You can also load it from CDN

<script src="https://cdn.jsdelivr.net/npm/editorjs-maths@1.0.0/dist/bundle.min.js"></script>

Usage

Add a new Tool to the tools property of the Editor.js initial config.

var editor = EditorJS({
  ...

  tools: {
    ...
    math: MathTool,
  }

  ...
});

Config Params

Field Type Description
placeholder string Code Tool's placeholder string

Output data

This Tool returns math.

{
    "type": "code",
    "data": {
        "tex": "x^2"
    }
}

KaTeX

This tool is build on top of KaTeX.