Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
storybook-addon-code
Advanced tools
A storybook addon that display any type of code highlighted with Prismjs
A Storybook addon enabling to show off code samples in the Storybook panel for your stories in Storybook.
npm i --save-dev storybook-addon-code
Create a file called addons.js
in your storybook config.
Add following content to it:
import * as CodeAddon from '../src/register';
CodeAddon.setTabs(
[{ label: 'Sass', type: 'sass' }, {label: 'TypeScript', type: 'typescript'}]
);
setTab function accept and object like {label: 'Sass', type:'sass'} or if you want to have multiple tabs you can pass an array with multiple objects. The label will pe displayed in the Storybook panel.
Then write your stories like this:
import { storiesOf } from '@storybook/react';
import withCode from 'storybook-addon-code';
import Button from './Button';
const styleFile = require('raw-loader!./style.scss');
const typescriptFile = require('./test.tsx');
storiesOf('Button', module)
.addDecorator(withCode(typescriptFile, 'typescript'))
.addDecorator(withCode(styleFile, 'sass'))
.add('with text', () =>
<Button onClick={action('clicked')}>Hello Button</Button>
)
Have a look at this example stories to learn more about the
withCode
API
FAQs
A storybook addon that display any type of code highlighted with Prismjs
The npm package storybook-addon-code receives a total of 51 weekly downloads. As such, storybook-addon-code popularity was classified as not popular.
We found that storybook-addon-code 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 found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.