Skip to content
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: MDX Linking #9051

Merged
merged 14 commits into from
Dec 4, 2019
Merged

Addon-docs: MDX Linking #9051

merged 14 commits into from
Dec 4, 2019

Conversation

patricklafrance
Copy link
Member

@patricklafrance patricklafrance commented Dec 3, 2019

Issue: #8184

What I did

Improved MDX linking:

  • It's now possible to link to an in page anchor.
  • URL to other stories are now automatically transformed to use the top level iframe url instead of the preview iframe url.
  • It's now possible to link to an anchor of another story
  • Calling a story with a hash will scroll to the matching element.
  • Github style autolink headers are automatically generated
  • target and rel attributes is automatically added to all external links (view remark-external-link plugin for more info)

sb_linking

How to test

  • Is this testable with Jest or Chromatic screenshots? No
  • Does this need a new example in the kitchen sink apps? Already done
  • Does this need an update to the documentation? Maybe?

It can be tested with the ?path=/docs/addons-docs-markdown-docs--page story of the official storybook.

@vercel
Copy link

vercel bot commented Dec 3, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

@shilman shilman added this to the 5.3.0 milestone Dec 4, 2019
@shilman shilman self-assigned this Dec 4, 2019
@shilman
Copy link
Member

shilman commented Dec 4, 2019

@patricklafrance this is INCREDIBLE! 💯💯💯

One small request is to fix the linking behavior. Storybook vs Github:

linking-sb

linking-gh

@patricklafrance
Copy link
Member Author

@shilman done!

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THIS IS SO RAD

@shilman shilman merged commit 21b8a7f into next Dec 4, 2019
@shilman shilman deleted the docs-in-page-linking branch December 4, 2019 03:42
@fooontic
Copy link

fooontic commented Jul 6, 2020

Is there any setting for this feature? Where can I find the sample code snippet of this feature? My Headings don't have ids, and I cant find how to fix it. Thanks

@lararosekelley
Copy link

Perhaps I'm missing something, but this doesn't appear to work as expected in the official docs - https://next--storybookjs.netlify.app/official-storybook/?path=/docs/addons-docs-markdown-docs--page

Clicking a heading just takes me to a blank page because it tries to go to the root path

@sag1v
Copy link

sag1v commented Dec 29, 2021

Perhaps I'm missing something, but this doesn't appear to work as expected in the official docs - https://next--storybookjs.netlify.app/official-storybook/?path=/docs/addons-docs-markdown-docs--page

Clicking a heading just takes me to a blank page because it tries to go to the root path

there's an open issue with a PR #16918

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants