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.
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
Version 0.1.1
FAQs
A storybook addon that display any type of code highlighted with Prismjs
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 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.