Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

storybook-addon-html

> 编程语言
Open source

A Storybook addon that extracts and displays compiled syntax-highlighted HTML

99 stars0 likes0 views
WebsiteGitHub

About

A Storybook addon that extracts and displays compiled syntax-highlighted HTML

Storybook Addon HTML

This addon for Storybook adds a panel tab that displays the rendered HTML for each story.

Requirements

Storybook 10.x

Use this version of the addon.

Storybook 9.x

Use version 8.x of this addon.

Installation

Install the addon with your package manager.

bash
npm i --save-dev @whitespace/storybook-addon-html

pnpm add -D @whitespace/storybook-addon-html

yarn add -D @whitespace/storybook-addon-html

Register addon

typescript
// .storybook/main.ts
import type { StorybookConfig } from '@storybook/your-framework';

const config: StorybookConfig = {
  // ...
  addons: ['@whitespace/storybook-addon-html'],
};

export default config;

Usage

All options are configured under the html story parameter.

root

Override the wrapper selector used to capture HTML.

typescript
export const parameters = {
  html: {
    root: '#my-custom-wrapper', // default: '#storybook-root, #root'
  },
};

removeComments

Remove comments from captured HTML. Set to true for all comments, or pass a RegExp to remove matching comments only.

typescript
export const parameters = {
  html: {
    removeComments: /^\s*remove me\s*$/,
  },
};

removeEmptyComments

Remove empty comments like and.

typescript
export const parameters = {
  html: {
    removeEmptyComments: true,
  },
};

highlighter

Configure syntax highlighter rendering in the panel.

typescript
export const parameters = {
  html: {
    highlighter: {
      showLineNumbers: true, // default: false
      wrapLines: false, // default: true
    },
  },
};

transform

Transform output HTML before rendering.

typescript
export const parameters = {
  html: {
    transform: (code: string) => code.replace(/(?:_nghost|ng-reflect).*?="[\S\s]*?"/g, ''),
  },
};

disable

Hide/disable the panel for a story.

typescript
export const parameters = {
  html: {
    disable: true,
  },
};

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptdev

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言