-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat(dgeni): render API source block #3385
base: develop
Are you sure you want to change the base?
feat(dgeni): render API source block #3385
Conversation
The link tag will bleed into other parts of the content without being rendered. Instead, directly render symbols to anchors. This will later allow us to easily change how these symbols are rendered, e.g. as an angular router link.
@xelaint @damienwebdev this is ready to preview and give feedback |
Is it possible to make the individual properties within the source block linkable to the properties section? When a user is on a page with a long source block section (i.e. |
@@ -2,5 +2,7 @@ | |||
<h1>{$ doc.name $}</h1> | |||
{% endblock %} | |||
<p>{$ doc.description $}</p> | |||
<h2>API</h2> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's necessary to have this heading?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I'm not attached to this specific heading, I think some separator between the description and the source block is necessary. When the descriptions includes some code blocks at the end (which is fairly common), I think its not immediately apparent that the source block is not part of the description. See /docs/api/auth/state/daffAuthProvideUnauthenticatedHooks
:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree there should be a separator then. Is the providers
code block a usage example? If so, I think we should also label it as usage example as well, or split up usage example and api into tabs like how angular does it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes the provider block is a usage example. I agree, we should tag it as @example
and render it separately (tabs sound good)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes the provider block is a usage example. I agree, we should tag it as
@example
and render it separately (tabs sound good)
Sounds good. @damienwebdev likes the idea of tabs as well.
yes this is my eventual goal. I'm not sure if it should be in this PR though since it will require changes to how the properties are laid out |
I like them but I'll leave the final decision up to you and @damienwebdev. I have them here mostly as an example of what the source blocks will look like for components. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Fixes: #3306
What is the new behavior?
One of the major outstanding issues with this is that the dgeni TS package doesn't correctly infer types of everything that TS can. For example, injection tokens and providers that are destructured from the factory function are untyped. Functions that do not have explicit return annotations have untyped return types even when TS correctly infers the return type.
Some of the
const
s that are function do have some of their type correctly inferred though.Does this PR introduce a breaking change?
Other information