ember-cli-addon-docs icon indicating copy to clipboard operation
ember-cli-addon-docs copied to clipboard

Possibility to link to a page anchor with {{docs-link}}

Open mriska opened this issue 6 years ago • 5 comments

It would be convenient if it was possible to link directly into an anchor in the api references using {{docs-link}}.

Maybe using a syntax like:

{{docs-link 'buttonType' 'docs.api.item' 'components/button' anchor='buttonType'}}

or even directly using

{{docs-link 'buttonType' 'docs.api.item' 'components/button#buttonType'}}

if that is even possible.

mriska avatar Jul 13 '18 07:07 mriska

I'm unsure how possible it would be, we would have to somehow compile that to a link and resolve it ahead of time because we can't render Ember components from the comments (they're converted into Ember Data models and end up being loaded dynamically, it would require a fair amount more work to turn them into first class templates).

Standard markdown links should work, though they could cause a full refresh which is definitely not desirable.

pzuraq avatar Jul 16 '18 19:07 pzuraq

I see, I'm fine with just being able to link to the particular page, which is possible with:

{{docs-link 'buttonType' 'docs.api.item' 'components/button'}}

I just thought it would have been nice to be able to target the correct anchor, but I understand now that it might not be quite as easy as it first seemed to me. :)

Feel free to close this issue unless you want to keep it around as a suggestion for the future - your call.

mriska avatar Jul 16 '18 19:07 mriska

Ah I'm sorry, did you mean in markdown pages? I assumed because you mentioned API references you meant in doc comment API. I agree, being able to link to hashes on pages would be ideal, if we can make a standardized way to do it we should

pzuraq avatar Jul 16 '18 19:07 pzuraq

Sorry, I was a bit unclear there. Yes, I was referring to links from markdown pages to the API reference pages.

mriska avatar Jul 16 '18 19:07 mriska

wonder if you could use href-to and something like concat to add the #anchor to the end?

samselikoff avatar Aug 14 '18 20:08 samselikoff