Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addon-Docs: HTML support & example #7454

Merged
merged 2 commits into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/docs/html/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../common/index');
1 change: 1 addition & 0 deletions addons/docs/html/preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../common/preset');
6 changes: 6 additions & 0 deletions examples/html-kitchen-sink/.storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { load, addParameters, addDecorator } from '@storybook/html';
import { withA11y } from '@storybook/addon-a11y';
import { DocsPage } from '@storybook/addon-docs/blocks';

addDecorator(withA11y);

Expand All @@ -13,7 +14,12 @@ addParameters({
},
options: {
hierarchyRootSeparator: /\|/,
docs: {
iframeHeight: '200px',
},
},
docs: DocsPage,
});

load(require.context('../stories', true, /\.stories\.js$/), module);
load(require.context('../stories', true, /\.stories\.mdx$/), module);
8 changes: 8 additions & 0 deletions examples/html-kitchen-sink/.storybook/presets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = [
{
name: '@storybook/addon-docs/html/preset',
options: {
configureJSX: true,
},
},
];
1 change: 1 addition & 0 deletions examples/html-kitchen-sink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@storybook/addon-actions": "5.2.0-beta.1",
"@storybook/addon-backgrounds": "5.2.0-beta.1",
"@storybook/addon-centered": "5.2.0-beta.1",
"@storybook/addon-docs": "5.2.0-beta.1",
"@storybook/addon-events": "5.2.0-beta.1",
"@storybook/addon-jest": "5.2.0-beta.1",
"@storybook/addon-knobs": "5.2.0-beta.1",
Expand Down
20 changes: 20 additions & 0 deletions examples/html-kitchen-sink/stories/addon-docs.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Story, Preview, Meta } from '@storybook/addon-docs/blocks';

# Storybook Docs for HTML

<Meta title="Addons|Docs" />

## Story definition

Hallelujah! HTML is working out of the box without modification.
How you like them apples?!

<Story name="heading" height="100px">
{'<h1>Hello World</h1>'}
Hypnosphi marked this conversation as resolved.
Show resolved Hide resolved
</Story>

## Story reference

You can also reference an existing story from within your MDX file.

<Story id="welcome--welcome" height="800px" />