New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rehype-prism

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rehype-prism

[![version](https://img.shields.io/npm/v/rehype-prism.svg?style=flat-square)](https://www.npmjs.com/package/rehype-prism) [![downloads](https://img.shields.io/npm/dm/rehype-prism.svg?style=flat-square)](https://www.npmjs.com/package/rehype-prism) [![licen

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
28K
decreased by-25.11%
Maintainers
1
Weekly downloads
 
Created
Source

rehype-prism

version downloads license dependencies

Install

npm i rehype-prism

Usage

import unified from 'unified'
import markdown from 'remark-parse'
import remark2rehype from 'remark-rehype'
import highlightCode from 'rehype-prism'
import html from 'rehype-stringify'

unified()
  .use(markdown)
  .use(remark2rehype)
  // it should be after rehype
  .use(highlightCode)
  .use(html)

Must disabled prism autoHighlight before import 'rehype-prism', if you use the plugin in browser. there are two way to do this:

  • set the window.Prism = { manual: true }

  • use the attribute data-manual on the <script> element you used for prism.

    <script src="prism.js" data-manual></script>

Load More Languages

  • Use babel-plugin-prismjs.(Recommend)
  • Use loadLanguages() provided by prismjs.(don't use loadLanguages() with Webpack or another bundler)

Load Themes

  • If you use babel-plugin-prismjs. import 'prismjs' will auto load the theme setted in babel-plugin-prismjs config.
  • Import theme css manual. e.g. import 'prismjs/themes/prism-coy.css'

Keywords

FAQs

Package last updated on 27 Nov 2018

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