Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@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>
markup
Metalsmith(__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)
The npm package @clarle/metalsmith-prism receives a total of 3 weekly downloads. As such, @clarle/metalsmith-prism popularity was classified as not popular.
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.