rehype-prism

A rehype plugin that highlights code blocks in HTML using Prism. It is used when generating documentation pages, and the Mapbox docs team no longer maintains it.

Share on XLicense: MIT

Overview

rehype-prism is a rehype plugin that highlights code blocks in HTML with Prism, through the refractor library. It looks at pre and code elements and uses the language class on the code element to pick the language. It can be used with rehype directly or in a unified pipeline that converts Markdown. It is no longer used or maintained by the Mapbox docs team.

Key features

  • Highlights pre and code blocks using Prism via refractor
  • Language chosen from a language-name class on the code element
  • ignoreMissing option skips unknown languages instead of throwing
  • alias option registers alternative language names

Best for

Node based documentation builds that need code highlighting in rehype. It is unmaintained since April 2024, and the README suggests lighter ways to highlight in the browser.

Upstream
mapbox/rehype-prism
Fork on GitHub
Guo-astro/rehype-prism
Upstream stars
173
Category
Developer tools and infrastructure
Language
JavaScript
License
MIT
Forked
2020-11-01
Sync status
In syncLast synced 2026-09-29