modernweb-dev / web

Guides, tools and libraries for modern web development.
https://modern-web.dev
MIT License
2.2k stars 278 forks source link

[dev-server-storybook] set storySource for JS stories #1193

Open LarsDenBakker opened 3 years ago

LarsDenBakker commented 3 years ago

As reported in https://github.com/modernweb-dev/web/issues/1178 when writing JS stories and viewing the generated docs, the story source code is not available. To make this available we need to add a compile step which adds the storySource parameter.

jorenbroekema commented 3 years ago

I could probably contribute this, can you point me in the right direction?

alangdm commented 2 years ago

A bit of a bump to this issue, I could look into trying this too if you can point us to what needs to be changed specifically

alangdm commented 2 years ago

Just as a side note, I took a look at what was discussed here: https://github.com/open-wc/open-wc/issues/2126

As far as I can tell, JS/TS stories currently still work, mdjs stories still don't render code

enqueue commented 2 years ago

We are trying to integrate stories into markdown (MDX) docs. While the stories render fine, the source code is not available for readers. Do you have any advice on how to create an integrated document? I started the example storybook from the dev-server-storybook package in this repository using npm run storybook:wc, which yields these results.

Button-mdjx-docs.stories.mdx

"Show source" is visible, but clicking on it does not show the source.

storybook_mdx

Button-mdx-docs.stories.md

Button reads "No code available" and a no parking cursor is shown.

storybook_mdjs

Button.stories.js

Source code is shown, but no integration in Markdown docs.

storybook_csf

P.S.: Sorry if if "hijacked" the wrong issue, but if I understand @alangdm 's comment correctly, they are facing the same challenge.