[addon-docs] Link to another story
See original GitHub issueIs 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:
See [this cool component](Components|General/CoolComponent) for more information
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.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:24
- Comments:10 (1 by maintainers)
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:
[link to another story](/?path=/docs/addons-docs-docs-only--page#bottom)
https://github.com/storybookjs/storybook/pull/9051/files#diff-809d0afec1adb3c90fb654474a0bf015
I just used @robbeman’s suggestion (thanks!) to navigate to another page with the
<LinkTo>
component. The router maintains scroll position (doesn’t scroll back to the top) but using anchor links actually worked. Here’s what I did:Notes:
writing-docs
- the ID of the other page--page
was needed to navigate to another Docs page, although I don’t like that it’s hacky#writing-documentation-stories
is the anchor to theh1
tag at the top of another pageI hope that helps.