# babel-plugin-prismjs

> A babel plugin to use PrismJS with standard bundlers.

Latest version **2.1.0** (published 2021-07-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-prismjs
pnpm add babel-plugin-prismjs
yarn add babel-plugin-prismjs
bun add babel-plugin-prismjs
```

## 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 | 2.1.0 |
| Published | 2021-07-07 |
| First published | 2018-05-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | James DiGioia |
| Maintainers | jamesdigioia |
| Keywords | prismjs, syntax-highlighting, babel-plugin |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-prismjs
- npm.io page: https://npm.io/package/babel-plugin-prismjs

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 2.1.0 (latest) — 2021-07-07
- 2.0.1 — 2020-01-19
- 2.0.0 — 2020-01-06
- 1.1.1 — 2019-07-24
- 1.1.0 — 2019-07-18
- 1.0.2 — 2018-06-15
- 1.0.1 — 2018-06-15
- 1.0.0 — 2018-05-24

## README

# babel-plugin-prismjs [![Build Status](https://travis-ci.org/mAAdhaTTah/babel-plugin-prismjs.svg?branch=master)](https://travis-ci.org/mAAdhaTTah/babel-plugin-prismjs)

A babel plugin to use PrismJS with standard bundlers.

## How to Use
This plugin allows you to treat PrismJS as a standard module and configure what languages, plugins, & themes you want to bundle with Prism.

In your code, import `prismjs`:

```js
import Prism from 'prismjs';

Prism.highlightAll();
```

The exported `Prism` object will be the fully-configured Prism instance.

### Limitations

- You must be using ES6 imports to load PrismJS.

## Configuring the plugin

In your .babelrc, register the plugin and configure its dependencies:

```json
{
  "plugins": [
    ["prismjs", {
        "languages": ["javascript", "css", "markup"],
        "plugins": ["line-numbers"],
        "theme": "twilight",
        "css": true
    }]
  ]
}
```

Each key are used as follows:

* `languages`: Array of languages to include in the bundle or `"all"` to include all languages. Those languages can be found [here](http://prismjs.com/#languages-list).
* `plugins`: Array of plugins to include in the bundle. Those plugins can be found [here](http://prismjs.com/#plugins).
* `theme`: Name of theme to include in the bundle. Themes can be found [here](http://prismjs.com/).
* `css`: Boolean indicating whether to include `.css` files in the result. Defaults to `false`. If `true`, `import`s will be added for `.css` files. Must be `true` in order for `theme` to work.

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