You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/faq.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Here are some answers to frequently asked questions. If you have a question, you
21
21
-[I see a "No Preview" error with a Storybook production build](#i-see-a-no-preview-error-with-a-storybook-production-build)
22
22
-[Can I use Storybook with Vue 3?](#can-i-use-storybook-with-vue-3)
23
23
-[Why aren't my code blocks highlighted with Storybook MDX](#why-arent-my-code-blocks-highlighted-with-storybook-mdx)
24
-
-[Why aren't my MDX 2 stories working in Storybook?](#why-arent-my-mdx-2-stories-working-in-storybook)
24
+
-[Why aren't my MDX stories working in Storybook?](#why-arent-my-mdx-stories-working-in-storybook)
25
25
-[Why are my mocked GraphQL queries failing with Storybook's MSW addon?](#why-are-my-mocked-graphql-queries-failing-with-storybooks-msw-addon)
26
26
-[Can I use other GraphQL providers with Storybook's MSW addon?](#can-i-use-other-graphql-providers-with-storybooks-msw-addon)
27
27
-[Can I mock GraphQL mutations with Storybook's MSW addon?](#can-i-mock-graphql-mutations-with-storybooks-msw-addon)
@@ -371,9 +371,9 @@ Yes, with the release of version 6.2, Storybook now includes support for Vue 3.
371
371
372
372
Out of the box, Storybook provides syntax highlighting for a set of languages (e.g., Javascript, Markdown, CSS, HTML, Typescript, GraphQL) you can use with your code blocks. Currently, there's a known limitation when you try and register a custom language to get syntax highlighting. We're working on a fix for this And will update this section once it's available.
373
373
374
-
## Why aren't my MDX 2 stories working in Storybook?
374
+
## Why aren't my MDX stories working in Storybook?
375
375
376
-
MDX 2 introduced some changes to how the code is rendered. For example, if you enabled it in your Storybook and you have the following code block:
376
+
MDX can be picky about how your code is formatted with line breaks. This is especially true with code blocks. For example, this will break:
377
377
378
378
```
379
379
<style>{`
@@ -388,7 +388,7 @@ MDX 2 introduced some changes to how the code is rendered. For example, if you e
388
388
389
389
```
390
390
391
-
You'll need to update it to make it compatible with MDX 2.
Copy file name to clipboardexpand all lines: docs/writing-docs/autodocs.md
+3-1
Original file line number
Diff line number
Diff line change
@@ -230,7 +230,9 @@ Out of the box, Storybook has a set of components that you can use to customize
230
230
231
231
<Calloutvariant="info"icon="💡">
232
232
233
-
This is not a Storybook issue but a breaking change introduced with MDX 2. For more information on this and other breaking changes, see our [MDX documentation](./mdx.md#breaking-changes).
233
+
This is not a Storybook issue but a detail of how MDX works. From their [migration guide](https://mdxjs.com/migrating/v2/#update-mdx-content):
234
+
235
+
“We now ‘sandbox’ components, for lack of a better name. It means that when you pass a component for h1, it does get used for `# hi` but not for `<h1>hi</h1>`”
Copy file name to clipboardexpand all lines: docs/writing-docs/mdx.md
+28-66
Original file line number
Diff line number
Diff line change
@@ -121,7 +121,7 @@ The `Meta` block defines where the document will be placed in the sidebar. In th
121
121
122
122
<!-- prettier-ignore-end -->
123
123
124
-
MDX2 supports standard markdown ([”commonmark”](https://commonmark.org/)) by default and can be extended to support [GitHub-flavored markdown (GFM)](https://github.github.com/gfm) and other extensions (see [Breaking changes](#breaking-changes), below).
124
+
MDX supports standard markdown ([”commonmark”](https://commonmark.org/)) by default and can be extended to support [GitHub-flavored markdown (GFM)](https://github.github.com/gfm) and other extensions (see [Breaking changes](#breaking-changes), below).
125
125
126
126
<!-- prettier-ignore-start -->
127
127
@@ -151,70 +151,7 @@ In addition to Doc Blocks, MDX can incorporate arbitrary React components, makin
151
151
152
152
### Known limitations
153
153
154
-
While MDX2 supports a variety of runtimes ([React](https://mdxjs.com/packages/react/), [Preact](https://mdxjs.com/packages/preact/), [Vue](https://mdxjs.com/packages/vue/)), Storybook’s implementation is React-only. That means your documentation is rendered in React, while your stories render in the runtime of your choice (React, Vue, Angular, Web Components, Svelte, etc.).
155
-
156
-
## Breaking changes
157
-
158
-
There are many breaking changes if you move from MDX 1 to version 2. As far as we know, all of these are due to changes in the MDX library itself rather than changes to Storybook’s usage. Nevertheless, as an MDX user, you will probably need to update your MDX files as part of the upgrade. MDX has published its own [Migration guide](https://mdxjs.com/migrating/v2/#update-mdx-files). Here, we try to summarize some of the fundamental changes for Storybook users.
159
-
160
-
### Custom components apply differently
161
-
162
-
From the MDX migration guide:
163
-
164
-
> We now “sandbox” components, for lack of a better name. It means that when you pass a component for `h1`, it does get used for `# hi` but not for `<h1>hi</h1>`
165
-
166
-
This means that the first heading in the following example gets replaced, whereas the second does not. It may not sound like a significant change, but in practice, it is highly disruptive and manifests itself in various ways. Unfortunately, this cannot be automatically converted in a safe way.
167
-
168
-
<!-- prettier-ignore-start -->
169
-
170
-
```md
171
-
# Some heading
172
-
173
-
<h1>another heading</h1>
174
-
```
175
-
176
-
<!-- prettier-ignore-end -->
177
-
178
-
### Lack of GitHub Flavored Markdown (GFM)
179
-
180
-
Also, from the MDX migration guide:
181
-
182
-
> We turned off GFM features in MDX by default. GFM extends CommonMark to add autolink literals, footnotes, strikethrough, tables, and task lists. If you do want these features, you can use a plugin. How to do so is described in [our guide on GFM](https://mdxjs.com/guides/gfm/).
183
-
184
-
In Storybook, you can apply MDX options, including plugins, in the main configuration file:
The [`remark-gfm`](https://github.com/remarkjs/remark-gfm) package isn't provided by default during migration. We recommend installing it as a development dependency if you use its features.
200
-
201
-
</Callout>
202
-
203
-
### Automigration
204
-
205
-
To help you transition to the new version, we've created a migration helper in our CLI. We recommend using it and reaching out using the default communication channels (e.g., [GitHub discussions](https://github.com/storybookjs/storybook/discussions/new?category=help)) for problems you encounter.
While MDX supports a variety of runtimes ([React](https://mdxjs.com/packages/react/), [Preact](https://mdxjs.com/packages/preact/), [Vue](https://mdxjs.com/packages/vue/)), Storybook’s implementation is React-only. That means your documentation is rendered in React, while your stories render in the runtime of your choice (React, Vue, Angular, Web Components, Svelte, etc.).
218
155
219
156
## Setup custom documentation
220
157
@@ -386,9 +323,34 @@ By applying this pattern with the Controls addon, all anchors will be ignored in
386
323
387
324
## Troubleshooting
388
325
326
+
### Markdown tables aren't rendering correctly
327
+
328
+
As of MDX 2, GFM is no longer included by default:
329
+
330
+
“We turned off GFM features in MDX by default. GFM extends CommonMark to add autolink literals, footnotes, strikethrough, tables, and task lists. If you do want these features, you can use a plugin. How to do so is described in [our guide on GFM](https://mdxjs.com/guides/gfm/).”
331
+
332
+
In Storybook, you can apply MDX options, including plugins, in the main configuration file:
The [`remark-gfm`](https://github.com/remarkjs/remark-gfm) package isn't provided by default during migration. We recommend installing it as a development dependency if you use its features.
348
+
349
+
</Callout>
350
+
389
351
### The MDX documentation doesn't render in my environment
390
352
391
-
As Storybook relies on the latest version of [MDX](https://mdxjs.com/) to render documentation, some technical limitations may prevent you from migrating to this version. If that's the case, we've prepared a set of instructions to help you transition to this new version.
353
+
As Storybook relies on [MDX 3](https://mdxjs.com/) to render documentation, some technical limitations may prevent you from migrating to this version. If that's the case, we've prepared a set of instructions to help you transition to this new version.
392
354
393
355
#### Storybook doesn't create documentation for my component stories
0 commit comments