-
-
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
[addon-docs] Link to another story #8618
Comments
You could use addon-links for this. I just checked and it is possible to use the Update: This apparently doesn't work for page anchors, so you might want to look at the other thread if you want to do in page links. |
I just used @robbeman's suggestion (thanks!) to navigate to another page with the import LinkTo from '@storybook/addon-links/react';
Please read the section on <LinkTo kind="writing-docs--page#writing-documentation-stories">Writing Documentation Stories</LinkTo> Notes:
I hope that helps. |
LinkTo works nicely 🙂 did some more digging and found a new PR Seems like since this issue was created you can potentially more reliably use a normal md link like this: |
Don't know if this is the right place for this, but can you link to the "Docs" I tried using the // This is what works for me right now to link to the story but it just goes to the story
<LinkTo kind="core-theme" story="color-palette">blah blah</LinkTo> // I tried these to link to the docs page but no go
<LinkTo kind="docs/core-theme" story="color-palette">blah blah</LinkTo>
<LinkTo kind="/docs/core-theme" story="color-palette">blah blah</LinkTo>
<LinkTo kind="docs/core-theme">blah blah</LinkTo> // This just goes to /docs/story/core-theme first story :( |
This suggestion from @Bamblehorse will lead to |
@mystrdat this might be a bug, but the immediate workaround is |
This seems to result in the same behavior, somehow Storybook actually modifies the url as such |
Noticed the same issue myself. I tried writing |
@joakimbeng Add |
For preventing
Adding |
I have created a test for internal linking for storybook 7.0 using beta 48 as this issue seems to persist there.
Other related issues:
cc: @yannbf |
Thanks! And FYI, this also works with Markdown linking syntax like so:
|
Is your feature request related to a problem? Please describe.
Well of course. I need to link to another story to sort of build a "See also" or "For more information, see..." section.
Describe the solution you'd like
I would like to be able to just link to another story by writing a MD link, something like:
Storybook would recognize that this is not a regular url, but a link to a story, and transform the link in such a way that it will navigate to that story, instead of trying to open the url as-is.
Describe alternatives you've considered
The best workaround at the moment would be to go to that story using the existing navigation, recording what the url is, and pasting that into the MD link. It doesn't feel like that's the most stable way to go, because I don't think those url's a completely chained to the components that are on them.
Are you able to assist bring the feature to reality?
Not sure I can, sorry.
Additional context
It might be worth noting that the documentation of MDX stories is a bit "all over the place". I feel there isn't a single source of truth when it comes to MDX. All I can find is a couple of use-cases (although very common ones) and their solutions, but not an exhaustive reference. Perhaps working on that may reveal that the feature being requested here, is already possible in some other way, that I have no way of being aware of.
The text was updated successfully, but these errors were encountered: