Skip to content

Commit d4537a1

Browse files
committed
adding local YAML contrib guidelines
1 parent 5effd3a commit d4537a1

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

contributing_to_docs/doc_guidelines.adoc

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,69 @@ Embedding external files is restricted for files that change frequently, like te
830830
You must get approval from the Engineering, QE, and Docs teams before embedding an external file.
831831
====
832832

833+
== Embedding a local YAML file
834+
835+
You can embed local YAML files in AsciiDoc modules.
836+
Consider embedding a local YAML file when you have a complete and valid YAML file that you want to use.
837+
This is useful when you want to include a complete YAML CR in the docs.
838+
The YAML file that you include must be a local file maintained in the link:https://github.com/openshift/openshift-docs[openshift-docs] GitHub repository.
839+
Use the `include` directive to target the local file.
840+
841+
To use a local YAML file, add it to the `snippets/` folder, and include it in your module. For example:
842+
843+
[source,yaml]
844+
----
845+
\include::snippets/install-config.yaml[]
846+
----
847+
848+
[NOTE]
849+
====
850+
Do not include link:https://docs.asciidoctor.org/asciidoc/latest/directives/include-lines/[lines by content ranges]. This approach can lead to content errors when the included file is subsequently updated.
851+
====
852+
853+
[IMPORTANT]
854+
====
855+
If the YAML file you want to include is from a GitHub repository that is managed by the `openshift` GitHub user, link to the file directly rather than copying the file to the `/openshift-docs` folder.
856+
====
857+
858+
[discrete]
859+
=== Using AsciiDoc callouts in the YAML
860+
861+
You can use AsciiDoc callouts in the YAML file.
862+
Comment out the callout in the YAML file to ensure that file can still be parsed as valid YAML.
863+
Asciidoctor recognises the commented callout and renders it correctly in the output.
864+
For example:
865+
866+
[source,yaml]
867+
----
868+
apiVersion: v1 # <1>
869+
----
870+
871+
[discrete]
872+
=== Version and upgrade implications
873+
874+
Carefully consider the version and upgrade implications of including the local YAML file in your content. Including a local YAML file can increase the maintenance overhead for the content.
875+
If you have a doubt, talk to your content strategist or docs team lead.
876+
877+
[discrete]
878+
=== Validating the local YAML file
879+
880+
Before you include the YAML file, use a YAML linter or the `oc` CLI to verify that the YAML is valid.
881+
For example, to validate the `snippets/SiteConfig.yaml` file using `oc`, log in to a cluster and run the following command from a terminal opened in the `openshift-docs/` folder:
882+
883+
[source,terminal]
884+
----
885+
$ oc apply -f snippets/SiteConfig.yaml --dry-run=client
886+
----
887+
888+
.Example output
889+
[source,terminal]
890+
----
891+
siteconfig.ran.openshift.io/example-sno created (dry run)
892+
----
893+
894+
Running `oc` with the `--dry-run=client` switch does not succeed with an invalid YAML file.
895+
833896
== Indicating Technology Preview features
834897

835898
To indicate that a feature is in Technology Preview, include the `snippets/technology-preview.adoc` file in the feature's assembly or module to keep the supportability wording consistent across Technology Preview features. Provide a value for the `:FeatureName:` variable before you include this module.

0 commit comments

Comments
 (0)