如何禁用Storybook 7中每个Story下的自动生成文档页面?

huangapple go评论93阅读模式
英文:

How can I disable the auto-generated Docs page under each Story in Storybook 7?

问题

我迁移到了Storybook 7,现在在每个Story下都出现了Docs页面。

我正在使用自定义的mdx,不使用addon-docs。

为了摆脱以前自动生成的文档,我以前可以使用以下配置选项:

  1. docs: {
  2. autodocs: false,
  3. }

但现在不起作用。

如何在Storybook 7中禁用autodocs?

英文:

I migrated to Storybook 7 and now under each Story appeared Docs page.

I'm using custom mdx and I don't use addon-docs.

To get rid of autogenerated docs previously I could use the following config option:

  1. docs: {
  2. autodocs: false,
  3. }

But now it doesn't help.

How to disable autodocs in Storybook 7?

答案1

得分: 1

如果您想禁用特定组件的自动文档生成,请在您的 Meta 块中尝试以下操作:

  1. export default {
  2. title: 'Example/Button',
  3. component: Button,
  4. // 删除这一行
  5. argTypes: {
  6. backgroundColor: { control: 'color' },
  7. },
  8. };
英文:

If you want to disable autodocs for a specific component, you can try this in your Meta block

  1. export default {
  2. title: 'Example/Button',
  3. component: Button,
  4. **tags: ['autodocs']**,//Remove this line
  5. argTypes: {
  6. backgroundColor: { control: 'color' },
  7. },
  8. };

答案2

得分: 0

Sure, here is the translated content:

如果你想完全禁用整个Storybook实例的自动生成文档功能,你可以将以下配置添加到你的 main.js 文件中:

  1. module.exports = {
  2. // 其他配置...
  3. features: {
  4. // 禁用自动生成文档
  5. storyStoreV7: false,
  6. },
  7. };
英文:

If you want to disable autodocs completely for your entire Storybook instance, you can add the following configuration to your main.js file:

  1. module.exports = {
  2. // other configuration...
  3. features: {
  4. // disable autodocs
  5. storyStoreV7: false,
  6. },
  7. };

huangapple
  • 本文由 发表于 2023年6月6日 01:04:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/76408595.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定