From 0c9d46b87f08122ef01ccf576a309f3a72e48729 Mon Sep 17 00:00:00 2001 From: Anshu Prateek Date: Mon, 23 Dec 2019 08:59:39 +0530 Subject: [PATCH] Add {{< codenew >}} shortcode to style guide This fixes #18231 --- .../en/docs/contribute/style/style-guide.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/content/en/docs/contribute/style/style-guide.md b/content/en/docs/contribute/style/style-guide.md index 30865c49e8ef3..57bd6dc981c42 100644 --- a/content/en/docs/contribute/style/style-guide.md +++ b/content/en/docs/contribute/style/style-guide.md @@ -380,6 +380,24 @@ The output is: {{< kat-button >}} +### Codenew + +Use {{}} to make code samples (eg manifests) downloadable. +Pages that provide ready-to-run sample manifests should put them in respective localized folder, (eg) content/en/examples/application/deployment.yaml (for English localization) and reference the downloadable code sample directly, using the {{}} shortcode. + +eg: {{}} + +The output is: + +{{< codenew file="application/deployment.yaml" >}} + +Example page containing above shortcode: + +https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/ + +Code samples may also have some localized context which should be updated in respective localized folder. Typically, code samples do not change, however natural-language comments can be translated. +For example: https://github.com/kubernetes/website/blob/master/content/ko/examples/application/deployment.yaml is the `ko` version for https://github.com/kubernetes/website/blob/master/content/en/examples/application/deployment.yaml + ## Common Shortcode Issues ### Ordered Lists