` block for any stories that need to exist within an iframe.
-
-To provide a tangible example of the inline/iframe rendering contexts, here's the same story rendered both ways.
-
-
-
-
-
-The biggest win here is that we don't have to worry about setting the height anymore. The story can calculate its height like any other inline element. As you can see, several of the stories on this page are quite small, but take up `500px`, because that's the default story height, and we didn't tweak the story to be an explicit height. Another huge gain here is in terms of performance. Using an iframe to render a single element is definitely unnecessary in most cases and, as you may have noticed while reading this page, can _really_ cause page performance to suffer.
-
-## Previews
-
-Just like in React, we can easily reference other stories in our docs:
-
-
-
-## More info
-
-For more info, check out the [Storybook Docs Technical Canvas](https://docs.google.com/document/d/1un6YX7xDKEKl5-MVb-egnOYN8dynb5Hf7mq0hipk8JE/edit?usp=sharing).
-
-We want your feedback to help make this more useful.
-
-Follow us on Twitter for more short demos & project updates! β€οΈππ
diff --git a/code/examples/web-components-kitchen-sink/src/stories/addons/docs/addon-docs.stories.mdx b/code/examples/web-components-kitchen-sink/src/stories/addons/docs/addon-docs.stories.mdx
deleted file mode 100644
index a6122c99817a..000000000000
--- a/code/examples/web-components-kitchen-sink/src/stories/addons/docs/addon-docs.stories.mdx
+++ /dev/null
@@ -1,7 +0,0 @@
-import { Meta } from '@storybook/addon-docs';
-
-
-
-# Stories
-
-Addon-docs supports `story.mdx` and `stories.mdx` for people who group their components by folder, e.g. `Button/{index.tsx,stories.mdx}`.
diff --git a/code/examples/web-components-kitchen-sink/src/stories/addons/docs/addon-docs.stories.ts b/code/examples/web-components-kitchen-sink/src/stories/addons/docs/addon-docs.stories.ts
deleted file mode 100644
index d294adad7b88..000000000000
--- a/code/examples/web-components-kitchen-sink/src/stories/addons/docs/addon-docs.stories.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { html } from 'lit';
-import { styleMap } from 'lit/directives/style-map.js';
-import type { Meta, StoryFn } from '@storybook/web-components';
-import mdxNotes from './notes/notes.mdx';
-
-export default {
- title: 'Addons / Docs / Stories',
-} as Meta;
-
-export const Basic: StoryFn = () => html`Click docs tab to see basic docs
`;
-
-export const NoDocs: StoryFn = () => html`Click docs tab to see no docs error
`;
-NoDocs.parameters = { docs: { page: null } };
-
-export const LargerThanPreview: StoryFn = () =>
- html`HUGE
`;
-
-export const MdxOverride: StoryFn = () =>
- html`Click docs tab to see MDX-overridden docs
`;
-MdxOverride.parameters = {
- docs: { page: mdxNotes },
-};
-
-export const InlineOverride: StoryFn = () =>
- html`Click docs tab to see JSX-overridden docs
`;
-InlineOverride.parameters = {
- docs: { page: () => html`Hello docs
` },
-};
-
-export const DocsDisable: StoryFn = () => html`This story shouldn't show up in DocsPage
`;
-DocsDisable.parameters = {
- docs: { disable: true },
-};
diff --git a/code/examples/web-components-kitchen-sink/src/stories/addons/docs/dynamic-source.stories.mdx b/code/examples/web-components-kitchen-sink/src/stories/addons/docs/dynamic-source.stories.mdx
deleted file mode 100644
index bbd8090cc9c6..000000000000
--- a/code/examples/web-components-kitchen-sink/src/stories/addons/docs/dynamic-source.stories.mdx
+++ /dev/null
@@ -1,43 +0,0 @@
-import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
-import { html } from 'lit-html';
-import '../../../components/sb-button'
-
-
-
-# Dynamic Source
-
-Stories can use Dynamic Source to display the result of changes to controls.
-
-
-
-
diff --git a/code/examples/web-components-kitchen-sink/src/stories/addons/docs/notes/notes.mdx b/code/examples/web-components-kitchen-sink/src/stories/addons/docs/notes/notes.mdx
deleted file mode 100644
index 906930d34547..000000000000
--- a/code/examples/web-components-kitchen-sink/src/stories/addons/docs/notes/notes.mdx
+++ /dev/null
@@ -1,9 +0,0 @@
-import { Story } from '@storybook/addon-docs';
-
-# Welcome!
-
-Let's write markdown without stories
-
-But we can still use doc blocks in our stories
-
-
diff --git a/code/frameworks/angular/template/stories/angular-mdx.stories.mdx b/code/frameworks/angular/template/stories/angular-mdx.stories.mdx
new file mode 100644
index 000000000000..d21169828d37
--- /dev/null
+++ b/code/frameworks/angular/template/stories/angular-mdx.stories.mdx
@@ -0,0 +1,25 @@
+import globalThis from 'global';
+import { moduleMetadata } from '@storybook/angular';
+import { Meta, Story, Canvas } from '@storybook/addon-docs';
+
+export const Button = globalThis.Components.Button;
+
+
+
+# Angular-specific MDX Stories
+
+
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-button/__snapshots__/doc-button.stories.storyshot b/code/frameworks/angular/template/stories/docgen-components/doc-button/__snapshots__/doc-button.stories.storyshot
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-button/__snapshots__/doc-button.stories.storyshot
rename to code/frameworks/angular/template/stories/docgen-components/doc-button/__snapshots__/doc-button.stories.storyshot
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-button/doc-button.component.html b/code/frameworks/angular/template/stories/docgen-components/doc-button/doc-button.component.html
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-button/doc-button.component.html
rename to code/frameworks/angular/template/stories/docgen-components/doc-button/doc-button.component.html
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-button/doc-button.component.scss b/code/frameworks/angular/template/stories/docgen-components/doc-button/doc-button.component.scss
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-button/doc-button.component.scss
rename to code/frameworks/angular/template/stories/docgen-components/doc-button/doc-button.component.scss
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-button/doc-button.component.ts b/code/frameworks/angular/template/stories/docgen-components/doc-button/doc-button.component.ts
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-button/doc-button.component.ts
rename to code/frameworks/angular/template/stories/docgen-components/doc-button/doc-button.component.ts
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-button/doc-button.stories.mdx b/code/frameworks/angular/template/stories/docgen-components/doc-button/doc-button.stories.mdx
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-button/doc-button.stories.mdx
rename to code/frameworks/angular/template/stories/docgen-components/doc-button/doc-button.stories.mdx
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-button/doc-button.stories.ts b/code/frameworks/angular/template/stories/docgen-components/doc-button/doc-button.stories.ts
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-button/doc-button.stories.ts
rename to code/frameworks/angular/template/stories/docgen-components/doc-button/doc-button.stories.ts
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-directive/__snapshots__/doc-directive.stories.storyshot b/code/frameworks/angular/template/stories/docgen-components/doc-directive/__snapshots__/doc-directive.stories.storyshot
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-directive/__snapshots__/doc-directive.stories.storyshot
rename to code/frameworks/angular/template/stories/docgen-components/doc-directive/__snapshots__/doc-directive.stories.storyshot
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-directive/doc-directive.directive.ts b/code/frameworks/angular/template/stories/docgen-components/doc-directive/doc-directive.directive.ts
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-directive/doc-directive.directive.ts
rename to code/frameworks/angular/template/stories/docgen-components/doc-directive/doc-directive.directive.ts
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-directive/doc-directive.stories.ts b/code/frameworks/angular/template/stories/docgen-components/doc-directive/doc-directive.stories.ts
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-directive/doc-directive.stories.ts
rename to code/frameworks/angular/template/stories/docgen-components/doc-directive/doc-directive.stories.ts
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-injectable/__snapshots__/doc-injectable.stories.storyshot b/code/frameworks/angular/template/stories/docgen-components/doc-injectable/__snapshots__/doc-injectable.stories.storyshot
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-injectable/__snapshots__/doc-injectable.stories.storyshot
rename to code/frameworks/angular/template/stories/docgen-components/doc-injectable/__snapshots__/doc-injectable.stories.storyshot
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-injectable/doc-injectable.service.ts b/code/frameworks/angular/template/stories/docgen-components/doc-injectable/doc-injectable.service.ts
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-injectable/doc-injectable.service.ts
rename to code/frameworks/angular/template/stories/docgen-components/doc-injectable/doc-injectable.service.ts
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-injectable/doc-injectable.stories.ts b/code/frameworks/angular/template/stories/docgen-components/doc-injectable/doc-injectable.stories.ts
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-injectable/doc-injectable.stories.ts
rename to code/frameworks/angular/template/stories/docgen-components/doc-injectable/doc-injectable.stories.ts
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-pipe/__snapshots__/doc-pipe.stories.storyshot b/code/frameworks/angular/template/stories/docgen-components/doc-pipe/__snapshots__/doc-pipe.stories.storyshot
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-pipe/__snapshots__/doc-pipe.stories.storyshot
rename to code/frameworks/angular/template/stories/docgen-components/doc-pipe/__snapshots__/doc-pipe.stories.storyshot
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-pipe/doc-pipe.pipe.ts b/code/frameworks/angular/template/stories/docgen-components/doc-pipe/doc-pipe.pipe.ts
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-pipe/doc-pipe.pipe.ts
rename to code/frameworks/angular/template/stories/docgen-components/doc-pipe/doc-pipe.pipe.ts
diff --git a/code/examples/angular-cli/src/stories/addons/docs/doc-pipe/doc-pipe.stories.ts b/code/frameworks/angular/template/stories/docgen-components/doc-pipe/doc-pipe.stories.ts
similarity index 100%
rename from code/examples/angular-cli/src/stories/addons/docs/doc-pipe/doc-pipe.stories.ts
rename to code/frameworks/angular/template/stories/docgen-components/doc-pipe/doc-pipe.stories.ts
diff --git a/code/lib/cli/rendererAssets/vue3/Button.vue b/code/lib/cli/rendererAssets/vue3/Button.vue
index 664f48cb3f06..b35d40db56b3 100644
--- a/code/lib/cli/rendererAssets/vue3/Button.vue
+++ b/code/lib/cli/rendererAssets/vue3/Button.vue
@@ -1,5 +1,5 @@
-
+
+
+Button view
+
+
+
+A little text to show this is a view.
+If we need to test components in a Svelte environment, for instance to test slot behaviour,
+then wrapping the component up in a view
+made just for the story is the simplest way to achieve this.
diff --git a/code/renderers/vue/template/stories/vue-mdx.stories.mdx b/code/renderers/vue/template/stories/vue-mdx.stories.mdx
new file mode 100644
index 000000000000..5cd3967d3029
--- /dev/null
+++ b/code/renderers/vue/template/stories/vue-mdx.stories.mdx
@@ -0,0 +1,44 @@
+import globalThis from 'global';
+import { Meta, Story, Canvas } from '@storybook/addon-docs';
+
+
+
+# Vue-specific MDX Stories
+
+export const Button = globalThis.Components.Button;
+
+export const Template = (args, { argTypes }) => ({
+ props: Object.keys(argTypes),
+ components: { MyButton: Button },
+ template: '',
+});
+
+## Primary
+
+
+
+## Secondary
+
+
+
+## From template
+
+
diff --git a/code/renderers/vue3/template/stories/vue3-mdx.stories.mdx b/code/renderers/vue3/template/stories/vue3-mdx.stories.mdx
new file mode 100644
index 000000000000..607683468336
--- /dev/null
+++ b/code/renderers/vue3/template/stories/vue3-mdx.stories.mdx
@@ -0,0 +1,46 @@
+import globalThis from 'global';
+import { Meta, Story, Canvas } from '@storybook/addon-docs';
+
+
+
+# Vue3-specific MDX Stories
+
+export const Button = globalThis.Components.Button;
+
+export const Template = (args, { argTypes }) => ({
+ components: { MyButton: Button },
+ template: '',
+ setup() {
+ return { args };
+ },
+});
+
+## Primary
+
+
+
+## Secondary
+
+
+
+## From template
+
+
diff --git a/scripts/sandbox.ts b/scripts/sandbox.ts
index cdc12469723e..f114cc71bcd5 100644
--- a/scripts/sandbox.ts
+++ b/scripts/sandbox.ts
@@ -214,7 +214,10 @@ async function readMainConfig({ cwd }: { cwd: string }) {
// loader for such files. NOTE this isn't necessary for Vite, as far as we know.
function addEsbuildLoaderToStories(mainConfig: ConfigFile) {
// NOTE: the test regexp here will apply whether the path is symlink-preserved or otherwise
- const loaderPath = require.resolve('../code/node_modules/esbuild-loader');
+ const esbuildLoaderPath = require.resolve('../code/node_modules/esbuild-loader');
+ const storiesMdxLoaderPath = require.resolve('../code/node_modules/@storybook/mdx1-csf/loader');
+ const babelLoaderPath = require.resolve('babel-loader');
+ const jsxPluginPath = require.resolve('@babel/plugin-transform-react-jsx');
const webpackFinalCode = `
(config) => ({
...config,
@@ -224,12 +227,55 @@ function addEsbuildLoaderToStories(mainConfig: ConfigFile) {
// Ensure esbuild-loader applies to all files in ./template-stories
{
test: [/\\/template-stories\\//],
- loader: '${loaderPath}',
+ exclude: [/\\.mdx$/],
+ loader: '${esbuildLoaderPath}',
options: {
loader: 'tsx',
target: 'es2015',
},
},
+ // Handle MDX files per the addon-docs presets (ish)
+ {
+ test: [/\\/template-stories\\//],
+ include: [/\\.stories\\.mdx$/],
+ use: [
+ {
+ loader: '${babelLoaderPath}',
+ options: {
+ babelrc: false,
+ configFile: false,
+ plugins: ['${jsxPluginPath}'],
+ }
+ },
+ {
+ loader: '${storiesMdxLoaderPath}',
+ options: {
+ skipCsf: false,
+ }
+ }
+ ],
+ },
+ {
+ test: [/\\/template-stories\\//],
+ include: [/\\.mdx$/],
+ exclude: [/\\.stories\\.mdx$/],
+ use: [
+ {
+ loader: '${babelLoaderPath}',
+ options: {
+ babelrc: false,
+ configFile: false,
+ plugins: ['${jsxPluginPath}'],
+ }
+ },
+ {
+ loader: '${storiesMdxLoaderPath}',
+ options: {
+ skipCsf: true,
+ }
+ }
+ ],
+ },
// Ensure no other loaders from the framework apply
...config.module.rules.map(rule => ({
...rule,
@@ -316,8 +362,9 @@ async function updateStoriesField(mainConfig: ConfigFile, isJs: boolean) {
// FIXME: '*.@(mdx|stories.mdx|stories.tsx|stories.ts|stories.jsx|stories.js'
const linkedStories = path.join('..', 'template-stories', '**', '*.stories.@(js|jsx|ts|tsx|mdx)');
+ const linkedMdx = path.join('..', 'template-stories/addons/docs/docs2', '**', '*.@(mdx)');
- mainConfig.setFieldValue(['stories'], [...updatedStories, linkedStories]);
+ mainConfig.setFieldValue(['stories'], [...updatedStories, linkedStories, linkedMdx]);
}
type Workspace = { name: string; location: string };