Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-prismjs

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-prismjs

A babel plugin to use PrismJS with standard bundlers.

  • 2.0.0
  • npm
  • Socket score

Version published
Weekly downloads
33K
decreased by-23.72%
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-prismjs Build Status

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:

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:

{
  "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. Those languages can be found here.
  • plugins: Array of plugins to include in the bundle. Those plugins can be found here.
  • theme: Name of theme to include in the bundle. Themes can be found here. Use lower-kebab-case for the theme name, e.g. solarized-light.
  • css: Boolean indicating whether to include .css files in the result. Defaults to false. If true, imports will be added for .css files. Must be true in order for theme to work.

Keywords

FAQs

Package last updated on 06 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc