百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

storybook-addon-html

> 编程语言
开源

一个故事书插件,可提取和显示经过编译的语法高亮的 HTML

99 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个故事书插件,可提取和显示经过编译的语法高亮的 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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptdev

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

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