-
Notifications
You must be signed in to change notification settings - Fork 182
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
hyperlink not generated for {@link type#property}
#732
Comments
Thanks - links on props are now resolved in |
Thanks for the quick fix @tgreyuk and appreciate the clarification on usage of Types are looking good with this fix but there is a strange issue with interfaces. Repro: https://stackblitz.com/edit/vitejs-vite-zdmljw8o When using |
You are absolutely correct, this isn't quite correct. The idea is that when an anchor cannot be resolved it fallsback to the nearest available anchor, but like you say the interface anchors should not be effected by the options you have set. Also foo.md#__type is not a correct fallback. Thanks again - ill be fixed in next patch. |
|
Thanks @tgreyuk! Just tested with 4.3.3 & latest typedoc 0.27.5 and things are improved, however one issue remains although I'm not 100% sure if it's expected or unexpected. When running When running Would you expect Updated Repro: https://stackblitz.com/edit/vitejs-vite-hbrlg3nz?file=docs-md2%2Ffunctions%2FhandleFoo.md |
Thanks @techfg,
This assumption is correct currently - the reason being that when properties are rendered in a table there is no anchor to link to in the page. However I appreciate that this is not very intuitive so should be addressed. It also means that anchors will get added everywhere (including next to markdown headings) where they are not needed. I think the most obvious thing to do would be to automatically add html anchors to relevant table cells in this use-case, or make "useHTMLAnchors" a bit smarter. I think for simplicity adding anchors automatically in this scenario makes sense. The initial rationale for not adding html automatically was that not all parsers support html, but as GFM supports html and markdown tables do not render without GFM, this is not a valid consideration. |
Thanks for providing the context/background.
Possibly I'm misunderstanding what you're staying here must markdown tables are supported beyond GFM I believe. With the recently added defaultRemarkPlugins If starting over, I think generating anchors everywhere with an option to restrict may be best. However, in order to not introduce a potential breaking change and to provide backwards compat, possibly extending I think if you do add anchors to tables by default for this use-case, there may need to be a way to disable them for certain scenarios/use-cases. All that said, I'm not even going to pretend to understand all the complexities of typedoc & typedoc-plugin-markdown and may be misunderstanding your comment to begin with so take the above FWIW 😄 Thanks again! |
@techfg thanks for comments.
Yes you are correct, markdown tables are indeed supported beyond GFM (which was an early adopter). Its really a bit of a mute point as most users will be consuming markdown beyond CommonMark (which does not include markdown tables as part of its spec).
This is relevant only when performing additional parsing with Remark using typedoc-plugin-remark. Remark converts a Markdown string to an AST and back to Markdown, supporting only the CommonMark specification by default.
For now i think we could preserve the "useHTMLAnchors" as a singular option which accepts a mode (but will also allow boolean value for backward compatibility).
Do you think this makes sense? |
Just to make sure I'm understanding your idea correctly:
Am I understanding correctly? Also, for my education, what other scenarios beyond table cells would |
Anchors would only ever be applied to next to headings or inside a table cells. The initial problem this option was trying to solve is that some parsers do not automatically assign header ids to html. It was then extended to also include anchoring to properties in table cells. Perhaps simply an option with flags might be better (or an additional option that defaults flags to true).
Hope this makes a bit more sense :) |
Thanks! Just one clarification....the current behavior of Assuming yes to above, then From there, I do agree that having flags nested instead of just In short, |
Yes this is correct. I will take this away - i think we are on the same understanding now - just need to decide on the exact option configuration! |
Sounds great and thanks for the patience in answering all the questions, just wanted to make sure I had a full and accurate understanding prior to providing my thoughts :) Appreciate all your work, thank you! |
No problem at all - thanks for the discussion. |
@techfg . Ok - after some deliberation on this I decided to implement what I think is the most simplistic and deterministic approach. As per changelog entry: Anchor IDs are now applied to linkable symbols within table rows by default. Previously, the useHTMLAnchors option was required, but since there is no alternative way to link to these items, this behaviour is now the default. I don't consider this a breaking change and I think is acceptable to release this change under a minor version. I will consider implementing the ability to turn this off if somebody has a good enough reason to request not to have it. "useHTMLAnchors" now only applies to page headings for platforms that dont provide automatic header ids. Hopefully this makes sense as I dont want to needlessly over complicate the options. Available in |
Looks good in v4.4.0 per expected behavior in changelog, thank you @tgreyuk! |
What package is the bug related to?
typedoc-plugin-markdown
Describe the issue
When using
@link
to reference a type property, the generated markdown is not hyperlinked.Repro: https://stackblitz.com/edit/vitejs-vite-rq6ycbce
Steps to Reproduce
npm run docs:md
docs-md/functions/handleFoo.md
Actual Result
Generated markdown does not hyperlink the
name
property:Additional Information
Foo
itself does get hyperlinkeduseHTMLAnchors=true
but this did not result inname
being hyperlinked either. In fact, there didn't seem to be any anchor elements generated at all - possibly I'm misunderstandinguseHTMLAnchors
or this may be a separate bug/issue?TypeDoc configuration
typedoc: 0.27.3
typedoc-plugin-markdown: 4.3.1
typescript: 5.7.2
Expected behavior
The property
name
should be hyperlinked.The text was updated successfully, but these errors were encountered: