storybookjs / builder-vite

A builder plugin to run and build Storybooks with Vite
MIT License
890 stars 108 forks source link

[Bug] MDX2 doesn't support tables (remark-gfm) #431

Open archangel-irk opened 2 years ago

archangel-irk commented 2 years ago

What version of vite are you using?

0.1.39

System info and storybook versions

Environment Info:

System: OS: macOS 12.4 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Binaries: Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm Browsers: Chrome: 103.0.5060.114 Firefox: 101.0.1 Safari: 15.5 npmPackages: @storybook/addon-a11y: 6.5.9 => 6.5.9 @storybook/addon-essentials: 6.5.9 => 6.5.9 @storybook/addon-links: 6.5.9 => 6.5.9 @storybook/addon-storysource: 6.5.9 => 6.5.9 @storybook/addons: 6.5.9 => 6.5.9 @storybook/builder-vite: 0.1.39 => 0.1.39 @storybook/mdx2-csf: 0.0.3 => 0.0.3 @storybook/react: 6.5.9 => 6.5.9 @storybook/testing-react: 1.3.0 => 1.3.0 @storybook/theming: 6.5.9 => 6.5.9

Describe the Bug

After opting to MDX2 we loose the support for "autolink literals, footnotes, strikethrough, tables, and task lists".

Migration guide from MDX tells us to install remark-gfm plugin manually and use it like this:

import remarkGfm from 'remark-gfm';

export default defineConfig({
   plugins: [mdx({remarkPlugins: [remarkGfm]})]
   ...
});

Yes, we can't use vite.config.ts but we also can't add this plugin manually in viteFinal.

Also the existing code doesn't pass any plugins to mdx compiler: https://github.com/storybookjs/builder-vite/blob/main/packages/builder-vite/plugins/mdx-plugin.ts#L59

Similar issue in mdx2-csf: https://github.com/storybookjs/mdx2-csf/pull/12

Link to Minimal Reproducible Example

No response

Participation

IanVS commented 2 years ago

@shilman @joshwooding do either of you have ideas of how we can support mdx plugins?

joshwooding commented 2 years ago

We would need the change in https://github.com/storybookjs/mdx2-csf/pull/12