
Product
Introducing Socket Scanning for OpenVSX Extensions
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.
@clarle/metalsmith-prism
Advanced tools
Syntax highlighting for Metalsmith HTML templates using Prism.js (with line numbers)
Syntax highlighting for Metalsmith HTML templates using Prism.js
The main difference between this package and Availity/metalsmith-prism is the support for line numbers, without any browser-side JavaScript. It's a bit of a hack, so use at your own risk.
npm install @clarle/metalsmith-prism --save-dev
<code class="language-css">p { color: red }</code>
metalsmith-prism plugin to metalsmithvar metalsmith = require('metalsmith');
var metalsmithPrism = require('@clarle/metalsmith-prism');
metalsmith(__dirname)
.use(metalsmithPrism())
.build();
var metalsmith = require('metalsmith');
var markdown = require('metalsmith-markdown');
var metalsmithPrism = require('@clarle/metalsmith-prism');
metalsmith(__dirname)
// Custom langPrefix option needed as markdown uses 'lang-' by default:
.use(markdown( { langPrefix: 'language-' } ))
.use(metalsmithPrism())
.build();
Supports all programming languages that have a corresponding Prism.js component file. Component files are found in the Prism.js components directory.
JSON syntax highlighting is enhanced using the following syntax definition
Prism.languages.json = {
'keys': /".+"(?=:)/g,
'boolean': /\b(true|false)/g,
'punctuation': /({|}|:|\[|\]|,)/g,
'keyword': /\b(null)\b/g
}
<code class="language-json">
{
ping: "pong"
}
</code>
markupMetalsmith(__dirname)
.use(metalsmithPrism({
decode: true
}))
Metalsmith(__dirname)
.use(metalsmithPrism({
json: {
'keys': /".+"(?=:)/g,
'boolean': /\b(true|false)/g,
'punctuation': /({|}|:|\[|\]|,)/g,
'keyword': /\b(null)\b/g
}
}))
line-numbers to parent <pre> tag if presentMetalsmith(__dirname)
.use(metalsmithPrism({
lineNumbers: true
}))
Robert McGuinness
Open source software components distributed or made available in the Availity Materials are licensed to Company under the terms of the applicable open source license agreements, which may be found in text files included in the Availity Materials.
Code and documentation copyright 2016 Availity, LLC. Code released under the MIT license.
FAQs
Syntax highlighting for Metalsmith HTML templates using Prism.js (with line numbers)
We found that @clarle/metalsmith-prism demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.

Product
Bringing supply chain security to the next generation of JavaScript package managers

Product
A safer, faster way to eliminate vulnerabilities without updating dependencies