Storybook: How to format code by docs plugin

Created on 13 Dec 2019  ·  1Comment  ·  Source: storybookjs/storybook

Describe the bug
Code preview format is messed up

To Reproduce
Steps to reproduce the behavior:
use Typescript

 config.module.rules.push({
    test: /\.(ts|tsx)$/,
    use: [
      {
        loader: require.resolve('awesome-typescript-loader'),
        options: {
          transpileOnly: true,
        },
      },
       {
         loader: require.resolve('react-docgen-typescript-loader'),
         options: {
           tsconfigPath: path.resolve(__dirname, '../tsconfig.json'),
         },
       },
    ],
  });

preset config

 {
    name: '@storybook/addon-docs/react/preset',
    options: {
      configureJSX: true,
      babelOptions: {},
      sourceLoaderOptions:null
    },
  },

Expected behavior
Format properly code preview
Official code snippet format
image

image

Screenshots
image

Code snippets

<Preview >
  <Story name="default">
    <Radio.Group value="apple">
      <Radio label="apple" />
      <Radio label="banana" />
      <Radio label="watermale" />
    </Radio.Group>
  </Story>
</Preview>

System:
yarn add -D @storybook/addon-docs

Additional context
Add any other context about the problem here.

source question / support

Most helpful comment

sorry my fault!!!! upgrade version 5.3.0 is ok

>All comments

sorry my fault!!!! upgrade version 5.3.0 is ok

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tlrobinson picture tlrobinson  ·  3Comments

dnlsandiego picture dnlsandiego  ·  3Comments

purplecones picture purplecones  ·  3Comments

ZigGreen picture ZigGreen  ·  3Comments

levithomason picture levithomason  ·  3Comments