Skip to content

Commit 4eeddcf

Browse files
author
Gaurav Nelson
authored
Merge pull request #5127 from gaurav-nelson/source_tag_guidelines_update
Updated guidelines to include source tags before code blocks
2 parents da67a8f + 954a3c9 commit 4eeddcf

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

contributing_to_docs/doc_guidelines.adoc

+31-20
Original file line numberDiff line numberDiff line change
@@ -404,39 +404,50 @@ configuration file represent, then use callouts to provide that information.
404404

405405
Follow these general guidelines when using code blocks:
406406

407-
* Do NOT show replaceables within code blocks.
408-
409407
* Do NOT use any markup in code blocks; code blocks generally do not accept any markup.
410408

411-
* Try to use callouts to provide information on what the output represents when required.
412-
413-
For all code blocks, you must include an empty line above a code block.
414-
409+
* For all code blocks, you must include an empty line above a code block.
410+
+
415411
Acceptable:
416-
412+
+
417413
....
418414
Lorem ipsum
419415
420416
----
421417
$ lorem.sh
422418
----
423419
....
424-
420+
+
425421
Not acceptable:
426-
422+
+
427423
....
428424
Lorem ipsum
429425
----
430426
$ lorem.sh
431427
----
432428
....
433-
429+
+
434430
Without the line spaces, the content is likely to be not parsed correctly.
435431

436-
Use this format when embedding callouts into the code block:
432+
* It is recommended to include source tags for the programming language used in the code block to enable syntax highlighting. For example, use the source tags
433+
`[source, bash]`, `[source, yaml]`, `[source, javascript]`.
434+
+
435+
....
436+
Lorem ipsum
437437
438+
[source, bash]
439+
----
440+
$ lorem.sh
441+
----
442+
....
443+
444+
* Try to use callouts to provide information on what the output represents when required.
445+
+
446+
Use this format when embedding callouts into the code block:
447+
+
438448
[subs=-callouts]
439449
....
450+
[source, bash]
440451
----
441452
code example 1 <1>
442453
code example 2 <2>
@@ -445,17 +456,17 @@ code example 2 <2>
445456
<2> A note about the second example value.
446457
....
447458

448-
For long lines of code that you want to break up among multiple lines, use a
459+
* For long lines of code that you want to break up among multiple lines, use a
449460
backslash to show the line break. For example:
450-
461+
+
462+
[source, bash]
451463
----
452464
$ oc get endpoints --all-namespaces --template \
453465
'{{ range .items }}{{ .metadata.namespace }}:{{ .metadata.name }} \
454466
{{ range .subsets }}{{ range .addresses }}{{ .ip }} \
455467
{{ end }}{{ end }}{{ "\n" }}{{ end }}' | awk '/ 172\.30\./ { print $1 }'
456468
----
457469

458-
459470
=== Inline Code or Commands
460471
Do NOT show full commands or command syntax inline within a sentence. The next section covers how to show commands and command syntax.
461472

@@ -478,17 +489,19 @@ To markup command syntax, use the code block and wrap the replaceables in <> wit
478489
....
479490
The following command returns a list of objects for the specified object type:
480491
492+
[source, bash]
481493
----
482-
oc get <object_type> <object_id>
494+
$ oc get <object_type> <object_id>
483495
----
484496
....
485497

486498
This would render as follows:
487499

488500
The following command returns a list of objects for the specified object type:
489501

502+
[source, bash]
490503
----
491-
oc get <object_type> <object_id>
504+
$ oc get <object_type> <object_id>
492505
----
493506

494507
==== Examples
@@ -499,33 +512,31 @@ As mentioned an example of a command should use actual values and also show an o
499512
In the following example the `oc get` operation returns a complete list of services that are currently defined.
500513
501514
.Example Title
502-
====
503515
516+
[source, bash]
504517
----
505518
$ oc get se
506519
NAME LABELS SELECTOR IP PORT
507520
kubernetes component=apiserver,provider=kubernetes <none> 172.30.17.96 443
508521
kubernetes-ro component=apiserver,provider=kubernetes <none> 172.30.17.77 80
509522
docker-registry <none> name=registrypod 172.30.17.158 5001
510523
----
511-
====
512524
....
513525

514526
This would render as shown:
515527

516528
In the following example the `oc get` operation returns a complete list of services that are currently defined.
517529

518530
.Example Title
519-
====
520531

532+
[source, bash]
521533
----
522534
$ oc get se
523535
NAME LABELS SELECTOR IP PORT
524536
kubernetes component=apiserver,provider=kubernetes <none> 172.30.17.96 443
525537
kubernetes-ro component=apiserver,provider=kubernetes <none> 172.30.17.77 80
526538
docker-registry <none> name=registrypod 172.30.17.158 5001
527539
----
528-
====
529540

530541
=== Lists
531542
Lists are created as shown in this example:

0 commit comments

Comments
 (0)