web icon indicating copy to clipboard operation
web copied to clipboard

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

Open LarsDenBakker opened this issue 4 years ago • 4 comments

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.

LarsDenBakker avatar Jan 10 '21 14:01 LarsDenBakker

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

jorenbroekema avatar Mar 05 '21 10:03 jorenbroekema

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 avatar Apr 13 '22 07:04 alangdm

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

alangdm avatar Apr 13 '22 07:04 alangdm

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.

enqueue avatar Aug 11 '22 15:08 enqueue