-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Add anchor ids to md doc headings #833
Comments
@bluetidepro You mean, keep the sidebar around when linking to e.g |
@seivan No, I mean like if you were to go to Again, the best example I have is something like this: https://github.com/styleguidist/react-styleguidist#third-party-tools - Where when you click that link it auto scrolls all the way down to the "third-party tools" section because the header has the anchor id on it. Really, think should be fairly simple to do. Just need to add id's to the component that generates the headers from the markdown and then make sure it works with the routing in place. |
Oh ok, you want your markdown tags have anchor links generated for them? |
@seivan Right, but that doesn't work in this use-case because sometimes you write markdown notes, headers, and comments above the examples, but the isolation mode for each example that you are referring to is just for the example part. So, if I wanted to link to a certain header of the component's page docs then I wouldn't be able to today. This is esp useful if you have long docs for a component, and that's the use-case that came up for me. Here is a screenshot of what I mean for my use-case: http://bluetide.pro/2cl4JB - As you can see, that's just a small portion of the long page of docs for the |
Understood! 👍 |
@seivan Sweet! Yeah, it should be fairly straight forward to build out, since it's just added an |
That’s a good idea! Feel free to send a PR for that ;-) You’ll probably need to prefix IDs to avoid clashes with already existing IDs that we generate on the backend. We already have |
AFAIK |
How's this coming along? Our team has opted to have each section and component displayed on it's own page, but some of those pages can get quite extensive and the inability to create anchors to the various parts of an individual page has started to become problematic. I've spent half a day now trying to find a way to create and link to anchors on an individual page but have not as of yet found a way to do it. Is support for page anchors still something that's being considered? |
It will be in Styleguidist as soon as someone submits a pull request. |
I'll probably look at building it out myself, but wanted to make a record of the idea just in case someone beats me to it.
Basically, the idea is that anytime in your component docs that you use a header (ex:
## Blah
) it would auto add anchor id's to it so you could ref it in the url. This is a similar concept to what GitHub auto does for.md
files. For example, I can link to https://github.com/styleguidist/react-styleguidist#usage and it will auto scroll to theUsage
header in that.md
file.To expand, if you had a header in the Button component docs, you could link to it to like https://react-styleguidist.js.org/examples/basic/#!/Button#example4 or something similar without going into isolation mode, but still linking to that part of the page in the doc.
We could also look at doing some fancy styling like GitHub has that shows an icon (on hover) of headers to get that url:
What is everyone's thoughts on this? Do you all think it would be worth having this feature? Would it conflict with the current routing at all, by any chance?
The text was updated successfully, but these errors were encountered: