@storybook/mdx1-csf
MDXv1 to CSF webpack compiler and loader
Last updated 2 years ago by shilman .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @storybook/mdx1-csf 
SYNC missed versions from official npm registry.

@storybook/mdx1-csf

Storybook's mdx1-csf is a compiler that turns MDXv1 input into CSF output.

For example, the following input:

import { Meta, Story } from '@storybook/addon-docs';

<Meta title="atoms/Button" />

<Story name="Bar">
  <Button>hello</Button>
</Story>

Might be transformed into the following CSF (over-simplified):

export default {
  title: 'atoms/Button',
};

export const Bar = () => <Button>hello</Button>;

API

This library exports three functions to compile MDX: compile, compileSync, and createCompiler.

compile

Asynchronously compile a string:

import { compile } from '@storybook/mdx1-csf';

const code = '# hello\n\nworld';
const output = await compile(code);

compileSync

Synchronously compile a string:

import { compileSync } from '@storybook/mdx1-csf';

const code = '# hello\n\nworld';
const output = compileSync(code);

createCompiler

Create a compiler plugin for for MDXv1:

import mdx from '@mdx-js/mdx';
import { createCompiler } from '@storybook/mdx1-csf';

const code = '# hello\n\nworld';
mdx.sync(code, { compilers: [createCompiler()] });

Loader

In addition, this library supports a simple Webpack loader that mirrors MDXv1's loader, but adds Webpack5 support.

module.exports = {
  module: {
    rules: [
      {
        test: /\.(stories|story)\.mdx$/,
        use: [
          {
            loader: require.resolve('@storybook/mdx1-csf/loader'),
            options: {},
          },
        ],
      },
    ],
  },
};

Contributing

We welcome contributions to Storybook!

  • 📥 Pull requests and 🌟 Stars are always welcome.
  • Read our contributing guide to get started, or find us on Discord, we will take the time to guide you

License

MIT

Current Tags

  • 1.0.1--canary.26.47c2c44.0                                ...           canary (2 years ago)
  • 1.0.0                                ...           latest (2 years ago)
  • 1.0.1-next.0                                ...           next (2 years ago)

30 Versions

  • 1.0.1-next.0                                ...           2 years ago
  • 1.0.1--canary.26.47c2c44.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 1.0.0-next.3                                ...           2 years ago
  • 0.0.5--canary.22.909f1b7.0                                ...           2 years ago
  • 0.0.5--canary.22.be941ab.0                                ...           2 years ago
  • 1.0.0-next.2                                ...           2 years ago
  • 0.0.5--canary.21.beb53e0.0                                ...           2 years ago
  • 0.0.5--canary.21.74eba40.0                                ...           2 years ago
  • 1.0.0-next.1                                ...           2 years ago
  • 0.0.5--canary.20.d7a3376.0                                ...           2 years ago
  • 1.0.0-next.0                                ...           2 years ago
  • 0.0.5--canary.19.89e7fd1.0                                ...           2 years ago
  • 0.0.5--canary.19.47a53e5.0                                ...           2 years ago
  • 0.0.5--canary.19.b1eabf8.0                                ...           2 years ago
  • 0.0.5--canary.19.e834b59.0                                ...           2 years ago
  • 0.0.5-canary.18.f777c36.0                                ...           2 years ago
  • 0.0.5-canary.18.832a6cd.0                                ...           2 years ago
  • 0.0.5-canary.13.9ce928a.0                                ...           2 years ago
  • 0.0.5-canary.13.39e8457.0                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.2-canary.5.6cee405.0                                ...           2 years ago
  • 0.0.2-canary.5.f835337.0                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
  • 0.0.1-canary.1.eed86d7.0                                ...           2 years ago
  • 0.0.1-canary.1.867dcd5.0                                ...           3 years ago
  • 0.0.1-canary.1.0025c94.0                                ...           3 years ago
  • 0.0.1-canary.1.8dbf866.0                                ...           3 years ago
Downloads
Total 2
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (2)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE