From 05068707cfe0faafa5490a3aea771209bd239d31 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Thu, 29 Apr 2021 23:42:12 +0800 Subject: [PATCH] Merge pull request #12547 from dancingshell/patch-1 Documentation: add `transcludeMarkdown` option in addon-docs --- addons/docs/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/addons/docs/README.md b/addons/docs/README.md index a293422d9f41..5ed4c96e90d7 100644 --- a/addons/docs/README.md +++ b/addons/docs/README.md @@ -154,6 +154,7 @@ module.exports = { configureJSX: true, babelOptions: {}, sourceLoaderOptions: null, + transcludeMarkdown: true, }, }, ], @@ -164,6 +165,16 @@ The `configureJSX` option is useful when you're writing your docs in MDX and you `sourceLoaderOptions` is an object for configuring `@storybook/source-loader`. When set to `null` it tells docs not to run the `source-loader` at all, which can be used as an optimization, or if you're already using `source-loader` in your `main.js`. +The `transcludeMarkdown` option enables mdx files to import `.md` files and render them as a component. +```mdx +import { Meta } from '@storybook/addon-docs/blocks'; +import Changelog from '../CHANGELOG.md'; + + + + +``` + ## Manual configuration We recommend using the preset, which should work out of the box. If you don't want to use the preset, and prefer to configure "the long way" add the following configuration to `.storybook/main.js` (see comments inline for explanation):