nachocodoner / draft-js-prism

Code highlighting for DraftJS using Prism

Home Page:http://samypesse.github.io/draft-js-prism/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Code highlighting for DraftJS using Prism

http://samypesse.github.io/draft-js-prism/

License:Apache License 2.0


Languages

Language:JavaScript 84.5%Language:CSS 8.4%Language:HTML 7.1%