LaTeX block support for EditorJS
npm install editorjs-latex` tag.
`html
`
To use with nodejs simply run `npm i editorjs-latex` and import using the following code:
`javascript
const EJLaTeX = require('editorjs-latex');
`
To add this library to EditorJS, simply add the follwing code:
`javascript
tools: {
Math: {
class: EJLaTeX,
shortcut: 'CMD+SHIFT+M'
}, ...
}
`If you need to adjust the theming of the editor, you can add CSS rules in the config like:
`javascript
tools: {
Math: {
class: EJLaTeX,
shortcut: 'CMD+SHIFT+M',
config: {
css: '.math-input-wrapper { padding: 5px; }'
}
}, ...
}
`Getting data
The output data of this plugin will look like bellow:`json
{
"type" : "Math",
"data" : {
"math" : "\\frac{a \\pm b}{(a+b)^2}"
}
}
``The "math" item contains the expression. You can use KaTeX to render that in your document.