ember-learn / ember-cli-addon-docs

Easy, beautiful docs for your OSS Ember addons
https://ember-learn.github.io/ember-cli-addon-docs
MIT License
176 stars 143 forks source link

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

Open mriska opened 6 years ago

mriska commented 6 years ago

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.

pzuraq commented 6 years ago

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.

mriska commented 6 years ago

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.

pzuraq commented 6 years ago

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

mriska commented 6 years ago

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

samselikoff commented 6 years ago

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