storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.46k stars 9.29k forks source link

MDX2: HTML comments break transcluded Markdown #18554

Closed shilman closed 1 year ago

shilman commented 2 years ago

Originally posted by @pixelass in https://github.com/storybookjs/storybook/issues/18383#issuecomment-1160767410

Looks like I found the issue while trying to build the repro.

It is an HTML comment within the markdown

README.md

# This file will not work

<!-- Because of this comment -->

Test.stories.mdx

import { Meta } from "@storybook/addon-docs";
import Readme from "../README.md";

<Meta title="Just / A /Test" />

<Readme />

which is then reactified via:

.stroybook/main.js (partial)


    {
      name: "@storybook/addon-docs",
      options: {
        configureJSX: true,
        sourceLoaderOptions: null,
        transcludeMarkdown: true,
      },
    },

Here's the very minimal repro: https://github.com/pixelass/sb-repro-mdx

There is only one story and a readme.md that should be rendered.

We used npm since this is how our project is set up but I expect the same issue to occur with yarn.


EDIT: I want to mention that removing the comments from all markdown files is not an option (it is also valid md and therefore should not cause issues)

zhyd1997 commented 2 years ago

it's mdx issue:

Screen Shot 2022-07-13 at 18 14 46
shilman commented 1 year ago

Closing as dupe to #20200