一覧へ戻る
mAAdhaTTah/babel-plugin-prismjs(新しいタブで開きます)
主要言語: JavaScript
A babel plugin to use PrismJS with standard bundlers.
- star 数
- 160
- watcher 数
- 1
- fork 数
- 9
- issue 数
- 19
- 最終更新
- 2023/01/07
主要言語: JavaScript
A babel plugin to use PrismJS with standard bundlers.
A babel plugin to use PrismJS with standard bundlers.
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'; // if you are intending to use Prism functions manually, you will need to set: Prism.manual = true; Prism.highlightAll();
The exported Prism object will be the fully-configured Prism instance.
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 or "all" to include all languages. 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.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.