-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using raw HTML in MDX files strips classes #8504
Comments
@fraincs This was introduced in #7771, which tries to isolate "document theming" vs. "user story theming", and is a little tricky.
|
Exactly, I currently documenting how H1s are affected by some atomic CSS classes, and wouldn't want Storybook styling to bleed. e.g. <h1 className="f6"... should only have f6 styling applied to it.
Yes as long as user's classes are applied after the classes that match the document styling |
Don't know if this will help, but with version |
@fraincs could you open a PR with a reproduction perhaps? That would make it easier to start work. |
@ndelangen see #8897 |
I just encountered this issue when trying to add our company logo to the introduction of our styleguide. Not a huge problem, but it would be nice to be able to selective style elements in our MDX file with a CSS file. |
@fraincs & everyone else , I just tried the reproduction sample on the latest 5.3 beta and can not reproduce either issue: Can you guys please try to upgrade to the latest 5.3 beta and post here if you can still reproduce the issue? |
Thanks @atanasster. Gonna close this!!! Please scream if it's still broken for you 😱 |
It's not strip anymore, but CSS classes added by MDX have precedence over the custom classes added by the user. You can see it in action in the following screenshot. Same code rendered twiced. The first box is in a story, the second is not. It would be nice if we could import a block like What do you think? |
@patricklafrance - probably this should be in a new , separate issue and more of a feature request. What was initially reported works fine now. As of now, your use case has a workaround too with !important modifier, right? |
@atanasster you're right. Sorry I re-opened the issue since in the current state, even if the classes are not strip, it still doesn't do it for us. I will create a separate issue. For !important, yes and no... Yes it would work. No since our docs use the same atomic CSS codebase that we use for our components and our apps. Adding !important to the selectors might cause a lot of regressions. We could write new selectors for the docs but I would prefer not doing it. |
FIX #8504 - HTML elements get their classes dropped in MDX
Jeepers creepers!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-alpha.11 containing PR #8897 that references this issue. Upgrade today to try it out! You can find this prerelease on the |
FIX #8504 - HTML elements get their classes dropped in MDX
Gadzooks!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.14 containing PR #8897 that references this issue. Upgrade today to try it out! |
Describe the bug
When using mdx as a source of doc, not wrapping the html in a story component strips all classes.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Using raw HTML in mdx would behave as straight HTML
Screenshots
Code snippets
Note that nor class or ClassName are working
System:
System:
OS: macOS Mojave 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Binaries:
Node: 12.7.0 - ~/.nvm/versions/node/v12.7.0/bin/node
Yarn: 1.19.1 - ~/Repos/sg-orbit/node_modules/.bin/yarn
npm: 6.10.0 - ~/.nvm/versions/node/v12.7.0/bin/npm
Browsers:
Chrome: 77.0.3865.120
Firefox: 69.0.1
Safari: 13.0.2
npmPackages:
@storybook/addon-actions: 5.2.4 => 5.2.4
@storybook/addon-console: 1.2.1 => 1.2.1
@storybook/addon-docs: 5.2.4 => 5.2.4
@storybook/addon-knobs: 5.2.4 => 5.2.4
The text was updated successfully, but these errors were encountered: