Skip to content

A PrismJS plugin for esbuild. Bundle the language and plugins set in the configuration at build time. The same options as babel-plugin-prismjs are available.

License

Notifications You must be signed in to change notification settings

activeguild/esbuild-plugin-prismjs

Repository files navigation

esbuild-plugin-prismjs ⚡ Welcome 😀

GitHub Actions status

If you are using babel, please use babel-plugin-prismjs.

Introduce

A PrismJS plugin for esbuild. Bundle the language and plugins set in the configuration at build time. The same options as babel-plugin-prismjs are available.

Install

npm i -D esbuild-plugin-prismjs

Usage

import { prismjsPlugin } from 'esbuild-plugin-prismjs'
import { build } from 'esbuild'

build({
  entryPoints: ['./src/index.ts'],
  outdir: 'dist',
  bundle: true,
  minify: true,
  platform: 'node',
  plugins: [
    prismjsPlugin({
      inline: true,
      languages: ['typescript', 'javascript', 'css', 'markup'],
      plugins: [
        'line-highlight',
        'line-numbers',
        'show-language',
        'copy-to-clipboard',
      ],
      theme: 'okaidia',
      css: true,
    }),
  ],
}).catch(() => process.exit(1))

Options

A plugin option is babel-plugin-prismjs and you can use the same option.

Original Options

Property Type Description
inline boolean Embed the css inline. (default true)

Principles of conduct

Please see the principles of conduct when building a site.

License

This library is licensed under the MIT license.

About

A PrismJS plugin for esbuild. Bundle the language and plugins set in the configuration at build time. The same options as babel-plugin-prismjs are available.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published