question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Addon-docs: classNames overwritten in inline MDX stories

See original GitHub issue

When using MDX docs, any classNames on markup written within a <Story> is getting converted into a small hashed name.

To Reproduce

<Story name="theme">
    <h1 className="text-lg">Hello Hugh</h1>
</Story>

Expected behavior The output should be:

<h1 class="text-lg">Hello Hugh</h1>

Actual output

<h1 className="sbdocs-h1 css-zj4ng8">Hello Hugh</h1>

Screenshots If applicable, add screenshots to help explain your problem. unknown

System: System: OS: macOS 10.14.6 CPU: (8) x64 Intel® Core™ i7-6820HQ CPU @ 2.70GHz Binaries: Node: 12.6.0 - ~/.nvm/versions/node/v12.6.0/bin/node Yarn: 1.17.3 - /usr/local/bin/yarn npm: 6.11.2 - ~/.nvm/versions/node/v12.6.0/bin/npm Browsers: Chrome: 76.0.3809.132 Firefox: 68.0.2 Safari: 12.1.2 npmPackages: @storybook/addon-a11y: ^5.2.0-rc.2 => 5.2.0-rc.2 @storybook/addon-actions: ^5.2.0-rc.2 => 5.2.0-rc.2 @storybook/addon-docs: ^5.2.0-rc.2 => 5.2.0-rc.2 @storybook/addon-knobs: ^5.2.0-rc.2 => 5.2.0-rc.2 @storybook/addon-storyshots: 5.2.0-rc.2 => 5.2.0-rc.2 @storybook/addon-storyshots-puppeteer: 5.2.0-rc.2 => 5.2.0-rc.2 @storybook/addon-storysource: ^5.2.0-rc.2 => 5.2.0-rc.2 @storybook/addons: ^5.2.0-rc.2 => 5.2.0-rc.2 @storybook/react: ^5.2.0-rc.2 => 5.2.0-rc.2 @storybook/source-loader: ^5.2.0-rc.2 => 5.2.0-rc.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
adamduncancommented, Oct 10, 2019

Hey, just circling back on this one. Is the prerequisite here that in order to avoid JSX classNames being hashed, we’ll need to wrap components etc. within a <Story> when writing MDX?

I’d like to write certain pages in “Docs mode” and just render the MDX, as opposed to a series of stories. Although I’m not sure I can add any markup with className in there without them being obfuscated?

1reaction
shilmancommented, Sep 3, 2019

Son of a gun!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.2.0-rc.4 containing PR #7974 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Closing this issue. Please re-open if you think there’s still more to do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MDX - Storybook
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and...
Read more >
Styling tags generated by @storybook/addon-docs from MDX ...
The <Story> tag has an "inline" attribute that tells Storybook whether to inline the story in the html or to render it in...
Read more >
@storybook/addon-controls | Yarn - Package Manager
Storybook Controls gives you a graphical UI to interact with a component's arguments dynamically, without needing to code. It creates an addon panel...
Read more >
borrow-ui - React UI component library starting kit
Author your React UI component library in minutes! Download borrow-ui, rename the project and you are ready to go.
Read more >
storybookjs/storybook (Raised $170.00) - Issuehunt
Update default `main.js:stories` to match `.mdx`. Unfunded#20249created bytmeasday ... [Bug]: next/link className props is not available in storybook.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found