fix: storybook readme addon is not showing the readme content #498
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Readme addon panel is not working with Storybook v7. It is most likely due to the change to Vite, where the raw-loader from Webpack was no longer working. Also the API for addons changed quite a bit from v6 to v7, so even though it is backwards compatible, we should upgrade it to the new API.
This PR aims to load README's in through Vite using their own raw loader (?raw) and then make the addon independent on how the README's are loaded, since the API changed so much that you can't get a component name anymore. Also it makes more sense that each story loads up its own markdown anyway.
I also managed to remove the "hack" that was in place to style code blocks appropriately, so now it works with Github Markdown CSS along with SyntaxHighlighter using prismjs without moving elements around by using the
customStyle
option to style the PreTag.Lastly, all stories have been updated to import their own README's and the handlebar template for new components have been updated to reflect this along with also using the new v7 StoryObj format.