-
Notifications
You must be signed in to change notification settings - Fork 109
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
resourcedocs: Add Anchors to inlined definitions #186
Conversation
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.
It passed CI, and the intention makes sense to me.
/lgtm
{{.TypeDefinition | indent 2 | indent .Indent | indent .Indent}} | ||
{{end}} | ||
{{- end}}{{/* range .Fields */}} | ||
|
||
{{range .FieldCategories}} | ||
### {{.Name}} | ||
### {{.Name}} {#{{.Name}}} |
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.
Maybe add a comment about why the fragment identifier is set?
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.
Do you need the set the fragment identifier if the same as the heading?
Hugo should automatically generate the anchors for the headings.
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.
See my comment below,I would like to keep the original case of the heading (which is a Resource Name)
👀 |
@@ -28,7 +28,7 @@ type Chapter interface { | |||
// Section is an interface to a section of an output | |||
type Section interface { | |||
AddContent(s string) error | |||
AddTypeDefinition(s string) error | |||
AddTypeDefinition(typ string, description string) error |
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.
nit: typ
is the type?
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, as type
is a reserved keyword in Go, we cannot use type
as variable name
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.
Right, typ
is odd. t
or something else might make it more readable.
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 think this is quite common in Go, see for example https://golang.org/pkg/go/types/
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.
Ha, interesting.
@@ -63,7 +63,6 @@ func escapeName(parts ...string) string { | |||
|
|||
// headingID returns the ID built by hugo for a given header | |||
func headingID(s string) string { | |||
result := strings.ToLower(s) | |||
result = strings.ReplaceAll(result, " ", "-") | |||
result := strings.ReplaceAll(s, " ", "-") |
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.
Is it necessary to normalize the heading?
I was under the impression that Hugo would do this.
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, Hugo does it by default, but puts the fragment in lowercase. I would prefer to keep the original case, as these are Resource names, and I would like to use the fragment name as text to display in the api-reference shortcode: (see https://github.com/kubernetes/website/pull/23294/files#diff-4992971bcbda91c2f2374a2e62fffda3d7852174780e027070e766c62bf87ac1 )
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 need to look at the generated pages.
Could you update the shortcode to adapt the formatting of the resource name?
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.
The shortcode has been changed in this commit: kubernetes/website@d9b18d3
The result should be visible in the paragraph https://deploy-preview-23294--kubernetes-io-master-staging.netlify.app/docs/concepts/configuration/secret/#using-imagepullsecrets (see the PodSpec API ...)
The build of the preview website fails, I can't see why
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.
looking now. See this message:
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
You need to rebase?
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 think I made a rebase to restart the tests in the meantime. Here is the commit:
kubernetes/website@99e1b41
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 also get the message, but you can see the change in the api-reference.html file of this commit
{{.TypeDefinition | indent 2 | indent .Indent | indent .Indent}} | ||
{{end}} | ||
{{- end}}{{/* range .Fields */}} | ||
|
||
{{range .FieldCategories}} | ||
### {{.Name}} | ||
### {{.Name}} {#{{.Name}}}{{/* explicitly set fragment to keep capitalization */}} |
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.
👍 to the comment, thanks @feloy
What happens when this code builds in CI? Are there files generated into a staging directory in this repository? |
And:
Why is ,
Found under the heading |
Hi @kbhawkey the headings are defined in the configuration file at (1) Note that the heading Lifecyle is different from the |
The changes are not visible in this repo, but you can see the changes in the PR (1), especially in the commits (2) and (3) (1) kubernetes/website#23294 |
Hi @feloy Conversely, the How did you select the text for the sub-headings? Would it help to list the fields alphabetically? I am reviewing this page:
|
Should I log an issue (to update a template) for separating the resource description (that contains a list) from the list of fields? For example,
|
Yes, please create an issue for this problem, I didn't see this problem before. |
Some more thoughts about intra-page links: It would be useful to link to any field in an object or resource from another page. What do you think about creating links for each field/list item? |
👍 See issue #188. |
Yes, I agree. |
I'm not sure, is there something to do on my side for this PR? |
/lgtm |
Thanks @feloy . |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: feloy, kbhawkey The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Inlined definitions into the Markdown generated by gen-resourcesdocs are not referenceable.
These changes adds anchors to the inlined definitions.
These changes also explicitly set fragment names for Resources.