Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

storybook-addon-prettier-source

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storybook-addon-prettier-source

Storybook addon to show inline story source formatted using prettier and a syntax highlighter

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
56
increased by460%
Maintainers
1
Weekly downloads
 
Created
Source

storybook-addon-prettier-source

Storybook addon to show inline story source code formatted using prettier and syntax highlighting

screenshot 1

Setup

# yarn
yarn add --dev storybook-addon-prettier-source

# npm
npm install --save-dev storybook-addon-prettier-source

Usage

Use as a global decorator in your .storybook/config.js file:

import { withPrettierSource } from 'storybook-addon-prettier-source';

addDecorator((story, context) => withPrettierSource(story, context));

Configuration

withPrettierSource takes an optional third parameter for configuring options

{
  prettier: { /* prettier options */ },
  syntaxHighlighter: { /* react-syntax-highlighter options */ }
}

prettier

We are using the standalone UMD bundle that runs in the browser, you can customise the options passed to pretter.format()

addDecorator((story, context) => withPrettierSource(story, context, {
  prettier: {
    parser: 'graphql',
    plugin: [require("prettier/parser-graphql")]
  }
}));

syntaxHighlighter

Customise any of the react-syntax-highlighter options to control how your source code looks

addDecorator((story, context) => withPrettierSource(story, context, {
  syntaxHighlighter: { showLineNumbers: true }
}));

Keywords

FAQs

Package last updated on 14 Aug 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc