tobiasdiez / storybook-vue-addon

Storybook stories in native Vue format
MIT License
46 stars 1 forks source link

Dedent Source Blocks in <Canvas /> elements #104

Open ms2d opened 6 months ago

ms2d commented 6 months ago

How can we dedent the source code for <Canvas /> elements, when using this plugin?

dedent-vue-canvas-source
ms2d commented 1 month ago

Looks like adding docs with format set to dedent does the trick:

/** @type { import('@storybook/vue3').Preview } */
import '../src/style.css';
const preview = {
  parameters: {
    actions: { argTypesRegex: '^on[A-Z].*' },
    controls: {
      matchers: {
        color: /(background|color)$/i,
        date: /Date$/i,
      },
    },
    docs: {
      source: {
        format: 'dedent',
      },
    },
  },
};

export default preview;