draft-js-prism
Code highlighting for DraftJS
Last updated 9 years ago by mxstbr .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install draft-js-prism 
SYNC missed versions from official npm registry.

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 prismjs

Usage

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

var decorator = new PrismDecorator({
  // Provide your own instance of PrismJS
  prism: Prism,
});
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

Current Tags

  • 1.0.6                                ...           latest (9 years ago)

5 Versions

  • 1.0.6                                ...           9 years ago
  • 1.0.5                                ...           9 years ago
  • 1.0.4                                ...           9 years ago
  • 1.0.3                                ...           10 years ago
  • 1.0.2                                ...           10 years ago
Maintainers (2)
Downloads
Total 14
Today 0
This Week 0
This Month 10
Last Day 0
Last Week 3
Last Month 3
Dependencies (2)
Dev Dependencies (14)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE