-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Docs doesn't have diff
support
#16080
Comments
Hi @rajzik , that seems a bit strange. Did you try applying what is documented here and see if it works on your case? To give you a bit more context, out of the box you get syntax highlighting for some languages (e.g., JS, TS, Graphql). To enable diff you have to configure the syntax highlighter to enable in your case I tried it with your reproduction and it's working, here's what i did:
import { Meta, Description } from "@storybook/addon-docs";
import Readme from "../README.md";
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import { dark } from "react-syntax-highlighter/dist/esm/styles/prism";
<Meta title="General/Readme" />
<Description>{Readme}</Description>
export const Component = () => {
return <SyntaxHighlighter style={dark} />;
};
Feel free to provide feedback, so that we close this issue, or continue to work on it until we find a solution for your issue. Stay safe |
@jonniebigodes it works. But is it possible to set syntax highlighter globally? I had to change quite a few files to get it done. |
@rajzik sorry for the delayed response. But i was otherwise engaged ! To the best of my knowledge you'll have to use the workaround that is currently documented. I'm aware that is quite cumbersome if you have a growing Storybook that uses MDX extensively. But to give you some context on this issue, in a previous Storybook release it was decided to remove some of the supported syntaxes in favor of performance. It might not be apparent to most users, but if you or any other user was working on a huge Storybook it would start to take a toll either in development mode or production mode. If you would be willing to work on this with us and provide a way that doesn't affect performance and provide you and the rest of the community with a solution we'd love to follow up with on it. If you're interested, check out our contribution documentation. Looking forward for your pull request. Have a great day! Stay safe |
@jonniebigodes I've seen you import the According to react-syntax-highlighter's demo the I'm currently v6.3.12 and it seems like no matter what I pull in the styles look the same. import SyntaxHighlighter from 'react-syntax-highlighter';
import { atomOneDarkReasonable } from 'react-syntax-highlighter/dist/esm/styles/hljs';
export const Component = () => {
return (<SyntaxHighlighter style={atomOneDarkReasonable} />);
};
"scss
$font-stack: Helvetica, sans-serif;
$primary-color: #333;
body {
font: 100% $font-stack;
color: $primary-color;
}
" No matter which style I pull in it always renders the same: Which looks like what you're showing above, not matter if it's Prism or HLJS. Is this a bug or has this been addressed in a newer version or is this the expected behavior, to force the one style? It seems like all this code does is restores all the other languages. Thanks |
@timbomckay the usage of the
The usage of ("") is to prevent the snippet from being processed. I've tested this on a reproduction running Storybook 6.3 and bumped the reproduction to the latest version and same results, asides from the dark none other worked. |
Hi all! Not sure if it's my particular setup, but this workaround doesn't seem to be working for me. As far as I can tell, react-syntax-highlighter seems to be bundled into the My storybook version is |
Update: this was working for me on version This makes the docs in this page https://storybook.js.org/docs/react/writing-docs/mdx#syntax-highlighting not work on |
This is happening to me as well. I've lost all highlighting not automatically included, including both diff and scss. I've tried using both the single page and global settings provided in the syntax highlighting docs as well as including |
@jimmynotjim My current workaround is to pin the version to -"@storybook/addon-essentials": "^6.5.0",
+"@storybook/addon-essentials": "6.5.9",
-"@storybook/core-common": "^6.5.0",
+"@storybook/core-common": "6.5.9",
-"@storybook/react": "^6.5.0",
+"@storybook/react": "6.5.9", (For all |
I'm experiencing the same issue as the most recent replies. I tried following the docs on adding a new language to highlight, but they were probably written before the dependency was bundled, also mentioned above. I thought it was because of Vite, but it appears to possibly be due to the bundling of @jonniebigodes, you had originally added the "has workaround" tag to this issue. I don't think it's applicable anymore, as pinning to an old version isn't a long-term workaround. Would you be able to look into this ticket again when you get a chance, please? |
Using
|
Any updates? We use Storybook v7 and we're having this issue as well. |
Describe the bug
Addon docs doesn't support diff.
Current state:
To Reproduce
https://github.com/rajzik/sb-repro
Other deployed SB can be found: https://next-storybook.oriflame.com/?path=/story/general-changelog--page
System
Additional context
It would be great to have at least some support for diff.
The text was updated successfully, but these errors were encountered: