draftjs-prism

Code highlighting for DraftJS

Usage no npm install needed!

<script type="module">
  import draftjsPrism from 'https://cdn.skypack.dev/draftjs-prism';
</script>

README

draftjs-prism

NPM version

draftjs-prism is a decorator for DraftJS to highlight code blocks using Prism.

Prism

Installation

$ npm install draftjs-prism

Usage

var Draft = require('draft-js');
var PrismDecorator = require('draftjs-prism');

var decorator = new PrismDecorator();
var editorState = Draft.EditorState.createEmpty(decorator)

You'll also need to include the css for one of the Prism themes.

You can use this decorator combined with others by using draftjs-multidecorators