# draft-js-prism

> Code highlighting for DraftJS

Latest version **1.0.6** (published 2018-02-03) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install draft-js-prism
pnpm add draft-js-prism
yarn add draft-js-prism
bun add draft-js-prism
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2018-02-03 |
| First published | 2016-05-31 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 271 |
| Author | Samy Pesse |
| Maintainers | mxstbr, samypesse |
| Keywords | draft-js |

## Links

- npm: https://www.npmjs.com/package/draft-js-prism
- Repository: https://github.com/SamyPesse/draft-js-prism
- Homepage: https://github.com/SamyPesse/draft-js-prism#readme
- Issues: https://github.com/SamyPesse/draft-js-prism/issues
- npm.io page: https://npm.io/package/draft-js-prism

## Dependencies (2)

- [extend](https://npm.io/package/extend.md) ^3.0.0
- [immutable](https://npm.io/package/immutable.md) *

## Recent versions

- 1.0.6 (latest) — 2018-02-03
- 1.0.5 — 2017-09-27
- 1.0.4 — 2017-09-22
- 1.0.3 — 2016-06-10
- 1.0.2 — 2016-05-31

## README

# draft-js-prism

[![NPM version](https://badge.fury.io/js/draft-js-prism.svg)](http://badge.fury.io/js/draft-js-prism)
[![Build Status](https://travis-ci.org/SamyPesse/draft-js-prism.svg?branch=master)](https://travis-ci.org/SamyPesse/draft-js-prism)

`draft-js-prism` is a decorator for DraftJS to highlight code blocks using [Prism](https://github.com/PrismJS/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](https://github.com/SamyPesse/draft-js-code).

![Prism](./preview.gif)

### Installation

```
$ npm install draft-js-prism prismjs
```

### Usage

```js
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](https://github.com/PrismJS/prism/tree/gh-pages/themes).

You can use this decorator combined with others by using [draft-js-multidecorators](https://github.com/SamyPesse/draft-js-multidecorators)

---
_Source: https://npm.io/package/draft-js-prism · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
