tuchk4 / storybook-readme

React Storybook addon to render README files in github style

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I use anchor links within a README without them reloading the page?

mattblack-twc opened this issue · comments

I have a reference/anchor pair that looks like this:

Metrics

When I click on the link in the rendered markdown, the page reloads and I'm taken from my local url for the story (/?path=/story/documenation-contexts--metrics) to a local url for the iframe (/iframe.html?id=documenation-contexts--metrics#metrics).

Is there a way to do anchors so that the page doesn't reload?

@mattblack-twc it is possible in this way

<h2 id="metrics">Metrics</h2>
<a href="#metrics" target="_self">Metrics</a>

That should have been a super obvious solution and it didn't even occur to me! thank you @tuchk4 !