markdown-it-prism
    Overview
    Documentation
    Tutorials
    Insights
    Code
    Dependencies
    Contributors
    Jobs

markdown-it-prism

Highlights code blocks in markdown-it using Prism.

2.0.3  •  Updated 7 months ago  •  by Joshua Gleitze  •  GNU General Public License v3.0 only

markdown-it plugin to highlight code blocks using Prism

Usage

const md = require('markdown-it')();
const prism = require('markdown-it-prism');

md.use(prism, options);

The plugin will insert the necessary markup into all code blocks. Include one of Prism’s stylesheets in your HTML to get highlighted code.

Options

The options object may contain:

Name Description Default
plugins Array of Prism Plugins to load. The names to use can be found here. Please note that some prism plugins (notably line-numbers) rely on the DOM being present and can thus not be used with this package (see #1). []
init A function called after setting up prism. Will receive the prism instance as only argument. Useful for plugins needing further intialisation. () => {}
defaultLanguageForUnknown The language to use for code blocks that specify a language that Prism does not know. No default will be used if this option is undefined. undefined
defaultLanguageForUnspecified The language to use for code block that do not specify a language. No default will be used if this option is undefined. undefined
defaultLanguage Shorthand to set both defaultLanguageForUnknown and defaultLanguageForUnspecified to the same value. undefined

Popularity

Weekly Downloads
491
Stars
17

Maintenance

Development

Last ver 7 months ago
Created 3 years ago
Last commit 6 months ago
19 days between commits

Technology

Node version: 12.7.0
47K unpacked

Compliance

GNU General Public License v3.0 only
OSI Approved
0 vulnerabilities

Contributors

4 contributors
Joshua Gleitze
Maintainer, 42 commits, 18 merges, 8 PRs
Joshua Gleitze
10 commits
renovate[bot]
7 commits
Takahiro Ikeuchi
2 commits, 2 PRs
Works at hakali
文剑木然
1 commits, 1 PRs
Works at Meituan-Dianping
ZhouHansen
1 PRs

Tags

markdown-it
markdown-it-plugin
highlight
prism
prismjs
Openbase helps developers choose among and use millions of open-source packages, so they can build amazing products faster.
FacebookTwitterLinkedIn
© 2020 Devstore, Inc.