-
Notifications
You must be signed in to change notification settings - Fork 105
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Is it necessary to normalize the heading? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. I need to look at the generated pages. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. looking now. See this message: There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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: There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
return result | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,19 +22,21 @@ weight: {{.Metadata.Weight}} | |
{{.Description | replace "<" "\\<" | indent 2 | indent .Indent | indent .Indent}} | ||
{{- end}} | ||
{{if .TypeDefinition}} | ||
{{ "" | indent .Indent | indent .Indent}} <a name="{{.Type}}"></a> | ||
{{.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 commentThe 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 commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) |
||
|
||
{{range .Fields}} | ||
{{ "" | indent .Indent | indent .Indent}}- {{.Name}}{{if .Value}}: {{.Value}}{{end}} | ||
{{if .Description}} | ||
{{.Description | replace "<" "\\<" | indent 2 | indent .Indent | indent .Indent}} | ||
{{- end}} | ||
{{if .TypeDefinition}} | ||
{{ "" | indent .Indent | indent .Indent}} <a name="{{.Type}}"></a> | ||
{{.TypeDefinition | indent 2 | indent .Indent | indent .Indent}} | ||
{{end}} | ||
{{- end}}{{/* range .Fields */}} | ||
|
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 usetype
as variable nameThere 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.