Code highlighting for DraftJS using Prism
JavaScript CSS HTML
Latest commit 8789c83 Jun 10, 2016 @SamyPesse Bump version to 1.0.3
Permalink
Failed to load latest commit information.
demo Rename into draft-js-prism May 31, 2016
lib Add basic tests Jun 10, 2016
.gitignore Add demo May 25, 2016
.travis.yml Initial commit May 25, 2016
LICENSE Initial commit May 25, 2016
README.md Add basic tests Jun 10, 2016
package.json Bump version to 1.0.3 Jun 10, 2016
preview.gif Initial commit May 25, 2016

README.md

draft-js-prism

NPM version Build Status

draft-js-prism is a decorator for DraftJS to highlight code blocks using Prism. It only decorates code blocks with syntax highlighting, if you're interested in providing a correct edition UX for code blocks, take a look at draft-js-code.

Prism

Installation

$ npm install draft-js-prism

Usage

var Draft = require('draft-js');
var PrismDecorator = require('draft-js-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 draft-js-multidecorators