# @reapit/storybook-addon-html

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

Latest version **5.0.1** (published 2021-07-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @reapit/storybook-addon-html
pnpm add @reapit/storybook-addon-html
yarn add @reapit/storybook-addon-html
bun add @reapit/storybook-addon-html
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 5.0.1 |
| Published | 2021-07-19 |
| First published | 2021-07-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 24.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 98 |
| Author | Whitespace |
| Maintainers | wmcvayreapit, dawsonscott |
| Keywords | addon, storybook, html, storybook-addon, code, popular |

## Links

- npm: https://www.npmjs.com/package/@reapit/storybook-addon-html
- Repository: https://github.com/whitespace-se/storybook-addon-html
- npm.io page: https://npm.io/package/@reapit/storybook-addon-html

## Dependencies (6)

- [prettier](https://npm.io/package/prettier.md) ~2.2.1
- [@babel/parser](https://npm.io/package/@babel/parser.md) ^7.13.12
- [@storybook/api](https://npm.io/package/@storybook/api.md) ^6.1.21
- [@babel/generator](https://npm.io/package/@babel/generator.md) ^7.13.9
- [@storybook/components](https://npm.io/package/@storybook/components.md) ^6.1.21
- [react-syntax-highlighter](https://npm.io/package/react-syntax-highlighter.md) ^15.4.3

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 5.0.1 (latest) — 2021-07-19

## README

**Fork of original module**

Forked purely to ensure Prettier is tagged at v2.2.X - a regex was introduced in Prettier v2.3.x which causes my Storybook build to fail. Full credit and thanks to the maintainers of this project.

# Storybook Addon HTML

This addon for Storybook adds a tab that displays the compiled HTML for each
story. It uses [highlight.js](https://highlightjs.org/) for syntax highlighting.

![Animated preview](https://raw.githubusercontent.com/whitespace-se/storybook-addon-html/master/image.gif)

## Getting Started

With NPM:

```sh
npm i --save-dev @whitespace/storybook-addon-html
```

With Yarn:

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

### Register addon

```js
// .storybook/main.js

module.exports = {
  // ...
  addons: [
    '@whitespace/storybook-addon-html',
    // ...
  ],
};
```

## Usage

The HTML is formatted with Prettier. You can override the Prettier config
(except `parser` and `plugins`) by providing an object following the
[Prettier API override format](https://prettier.io/docs/en/options.html) in the
`html` parameter:

```js
// .storybook/preview.js

export const parameters = {
  // ...
  html: {
    prettier: {
      tabWidth: 4,
      useTabs: false,
      htmlWhitespaceSensitivity: 'strict',
    },
  },
};
```

You can override the wrapper element selector used to grab the component HTML.

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

When using Web Components, the HTML will contain empty comments, i.e. `<!---->`.
If you want to remove these, use the `removeEmptyComments` parameter:

```js
export const parameters = {
  html: {
    removeEmptyComments: true, // default: false
  },
};
```

You can override the `showLineNumbers` and `wrapLines` settings for the syntax
highlighter by using the `highlighter` parameter:

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

## Supported frameworks

As of version 4.0.0 all frameworks are supported per default 🎉

---
_Source: https://npm.io/package/@reapit/storybook-addon-html · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
