Repository navigation
Conversation
✅ Pull request preview available for checkingBuilt without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
From 10-13-2026 SIG Docs meeting:
Notes to @TineoC: This pr should target cc. @lmktfy @katcosgrove |
e8022db to
ca3c1f6
Compare
|
/remove-area blog |
lmktfy
left a comment
There was a problem hiding this comment.
Thanks for this. Sorry it's been a while waiting on reviews.
Overall, I think we can split this more.
- changes to make it possible to have multiple serializations of the same code (or manifest) sample
- changes to make it easier to work with KYAML
- actually using KYAML in some pages
(and personally, I like the idea that we verify it works, then split off the commit for this into its own separate / follow-up PR)
| `scripts/README.md` covers the rest: why the conventional YAML stays canonical, | ||
| which manifests get no KYAML rendering, and how localizations opt in. |
There was a problem hiding this comment.
This reads like AI. Consider rewording it?
| Returns the objects a manifest describes, as JSON, one entry per document in it. | ||
| Comparing that instead of the text is how two renderings of one manifest are | ||
| checked against each other: a dialect changes the spelling, so only the decoded | ||
| objects are comparable. | ||
|
|
||
| Expects a dict with: | ||
| key a name unique to this manifest and dialect, for the temporary | ||
| resource; derive it from the path actually read, so that two | ||
| languages holding the same manifest name do not share one resource | ||
| content the manifest text | ||
|
|
||
| Each document goes through a .yaml-named resource because transform.Unmarshal | ||
| guesses a bare string's format and KYAML's leading brace reads as JSON; jsonify | ||
| then orders the keys, leaving only meaning to compare. |
There was a problem hiding this comment.
What's the purpose of this partial? I don't quite get it.
| @@ -0,0 +1,24 @@ | |||
| {{- /* | |||
| Renders one example manifest. | |||
There was a problem hiding this comment.
| Renders one example manifest. | |
| Renders one example code sample (usually a manifest). |
There was a problem hiding this comment.
Docsy provides a similar shortcode; are we drifting further from it?
| {{/* The dialects an example can be offered in besides the conventional YAML it | ||
| is written as, from params.codeSampleDialects in hugo.toml. Configuring one | ||
| and generating for it are separate: nothing here changes a page until a | ||
| generator has left renderings in content/<lang>/examples-<name>. */}} |
There was a problem hiding this comment.
Don't imply or assume that a code sample defaults to YAML.
| {{/* The tabs are the site's own, from layouts/partials/tabs.html, so a dialect | ||
| chosen here is remembered the way every other tab choice on the site is: | ||
| the persistence key is the dialect's name, so picking one picks it for every | ||
| other example and the choice survives to the next page. Without JavaScript | ||
| the first tab, conventional YAML, is the one shown. */}} |
There was a problem hiding this comment.
Don't imply or assume that a code sample defaults to YAML.
Also, we should try to align more with Docsy where we can.
| the persistence key is the dialect's name, so picking one picks it for every | ||
| other example and the choice survives to the next page. Without JavaScript | ||
| the first tab, conventional YAML, is the one shown. */}} | ||
| {{ $tabs := slice (dict "label" "YAML" "persist" "yaml" "content" (partial "code-sample-pane.html" $yamlPane)) }} |
There was a problem hiding this comment.
Don't imply or assume that a code sample defaults to YAML. However, it's OK to have a special kind of code_sample that does have a list of variant serializations. Or other approaches, so long as we aren't disallowing plain-JSON code samples, etc.
| "tabindex" "0" | ||
| "tabs" $tabs) }} | ||
| {{ else }} | ||
| {{ partial "code-sample-pane.html" $yamlPane }} |
There was a problem hiding this comment.
Don't imply or assume that a code sample defaults to YAML.
There was a problem hiding this comment.
Docsy provides a similar shortcode; are we drifting further from it?
|
|
||
| This script renders selected example manifests a second time as | ||
| [KYAML](https://kubernetes.io/docs/reference/encodings/kyaml/), so the | ||
| `code_sample` shortcode can show them in either dialect. |
There was a problem hiding this comment.
Don't imply or assume that a code sample defaults to YAML. A minor rewording is all that's needed here.
There was a problem hiding this comment.
I don't think this should be placed in scripts.
Signed-off-by: Christopher Tineo <christophertineo02@gmail.com>
ca3c1f6 to
a792b06
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
I did the split. https://github.com/kubernetes/website/pull/58042/changes#diff-299817675e7f7c5e1721b159d971f7c08dea8caf3e3cd1b637afdd695fe8ad02R344 They can opt in by passing a variant. cc. @lmktfy |
|
the solution is kyaml-specific (specially if you see #59129). Do you think might be worth making this extensible for future variants? |

Description
Lets
code_sampleshow a sample in more than one format, as tabs. Opt-in per sample:The extra file is read from
content/<lang>/examples-kyaml/. Withoutvariants, nothing changes. No page uses it yet.Split from the original version of this PR, per review:
Test: Hugo shortcodes (new section), Pods (renders as before).
Issue
Part of #57030 (KEP-5295). Relates to #59129.
This PR was written in part with the assistance of generative AI.
/sig docs
/language en