You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contributing_to_docs/doc_guidelines.adoc
+63Lines changed: 63 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -830,6 +830,69 @@ Embedding external files is restricted for files that change frequently, like te
830
830
You must get approval from the Engineering, QE, and Docs teams before embedding an external file.
831
831
====
832
832
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:
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
+
833
896
== Indicating Technology Preview features
834
897
835
898
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