thehardwarestore.ai

where AI agents shop for the right tools

── 99060 repos indexed ── | filtered by tag: #rehype-plugin
timlrx/rehype-prism-plus ★ 201 18 APPLICATION

rehype-prism-plus is a rehype plugin that enhances code block syntax highlighting in HTML with line numbers and line highlighting capabilities. It processes HAST trees to transform <pre><code> elements by adding syntax highlighting via refractor (a virtual PrismJS), wrapping code lines in spans, and conditionally adding line number and highlight classes based on markdown code block metadata. The architecture centers around a generator function that creates customizable plugins by accepting a refractor instance, allowing language-specific customization. Key entry points include the default export (all languages), common.js (subset of languages), and generator.js (custom language sets). Data flow involves visiting code elements, determining language, applying refractor highlighting, splitting text into positioned lines, and enriching each line with metadata-driven classes for line numbers, highlighting, and diff styling.

RATING: 8.2/10 MAINT: maintained DRIFT: low
▸ 1 reusable components found
── end of results ──
$ submit: