Skip to content

Commit d6aea95

Browse files
author
Mrunal Patel
committed
Merge pull request #348 from vbatts/anchor-examples
Anchor examples
2 parents 93a6ffd + 7dbab77 commit d6aea95

File tree

3 files changed

+80
-9
lines changed

3 files changed

+80
-9
lines changed

config.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The OpenContainer spec follows semantic versioning and retains forward and backw
1515
For example, if an implementation is compliant with version 1.0.1 of the spec, it is compatible with the complete 1.x series.
1616
NOTE that there is no guarantee for forward or backward compatibility for version 0.x.
1717

18-
*Example*
18+
### Example
1919

2020
```json
2121
"ociVersion": "0.1.0"
@@ -28,7 +28,7 @@ Each container has exactly one *root filesystem*, specified in the *root* object
2828
* **`path`** (string, required) Specifies the path to the root filesystem for the container, relative to the path where the manifest is. A directory MUST exist at the relative path declared by the field.
2929
* **`readonly`** (bool, optional) If true then the root filesystem MUST be read-only inside the container. Defaults to false.
3030

31-
*Example*
31+
### Example
3232

3333
```json
3434
"root": {
@@ -48,7 +48,7 @@ The parameters are similar to the ones in [the Linux mount system call](http://m
4848
* **`source`** (string, required) a device name, but can also be a directory name or a dummy. Windows, the volume name that is the target of the mount point. \\?\Volume\{GUID}\ (on Windows source is called target)
4949
* **`options`** (list of strings, optional) in the fstab format [https://wiki.archlinux.org/index.php/Fstab](https://wiki.archlinux.org/index.php/Fstab).
5050

51-
### Linux Example
51+
### Example (Linux)
5252

5353
```json
5454
"mounts": [
@@ -67,7 +67,7 @@ The parameters are similar to the ones in [the Linux mount system call](http://m
6767
]
6868
```
6969

70-
### Windows Example
70+
### Example (Windows)
7171

7272
```json
7373
"mounts": [
@@ -118,7 +118,7 @@ For Linux-based systems the user structure has the following fields:
118118

119119
_Note: symbolic name for uid and gid, such as uname and gname respectively, are left to upper levels to derive (i.e. `/etc/passwd` parsing, NSS, etc)_
120120

121-
*Example (Linux)*
121+
### Example (Linux)
122122

123123
```json
124124
"process": {
@@ -159,7 +159,7 @@ _Note: symbolic name for uid and gid, such as uname and gname respectively, are
159159

160160
* **`hostname`** (string, optional) as it is accessible to processes running inside. On Linux, you can only set this if your bundle creates a new [UTS namespace][uts-namespace].
161161

162-
*Example*
162+
### Example
163163

164164
```json
165165
"hostname": "mrsdalloway"
@@ -170,6 +170,8 @@ _Note: symbolic name for uid and gid, such as uname and gname respectively, are
170170
* **`os`** (string, required) specifies the operating system family this image must run on. Values for os must be in the list specified by the Go Language document for [`$GOOS`](https://golang.org/doc/install/source#environment).
171171
* **`arch`** (string, required) specifies the instruction set for which the binaries in the image have been compiled. Values for arch must be in the list specified by the Go Language document for [`$GOARCH`](https://golang.org/doc/install/source#environment).
172172

173+
### Example
174+
173175
```json
174176
"platform": {
175177
"os": "linux",
@@ -216,7 +218,7 @@ The post-stop hooks are called after the container process is stopped.
216218
Cleanup or debugging could be performed in such a hook.
217219
If a hook returns a non-zero exit code, then an error is logged and the remaining hooks are executed.
218220

219-
*Example*
221+
### Example
220222

221223
```json
222224
"hooks" : {

runtime.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This allows the hooks to perform cleanup and teardown logic after the runtime de
2020
This is provided so that consumers can find the container's configuration and root filesystem on the host.
2121

2222
When serialized in JSON, the format MUST adhere to the following pattern:
23+
2324
```json
2425
{
2526
"ociVersion": "0.2.0",
@@ -99,8 +100,10 @@ The JSON describing the new process MUST adhere to the [Process configuration](c
99100
This operation MUST create a new process within the scope of the container.
100101
If the container is not running then this operation MUST have no effect on the container and MUST generate an error.
101102
Executing this operation multiple times MUST result in a new process each time.
102-
Example:
103-
```
103+
104+
#### Example
105+
106+
```json
104107
{
105108
"terminal": true,
106109
"user": {
@@ -118,6 +121,7 @@ Example:
118121
"cwd": "...",
119122
}
120123
```
124+
121125
This specification does not mandate the name of this JSON file.
122126
See the specification of the `config.json` file for the definition of these fields.
123127
The stopping, or exiting, of these secondary process MUST have no effect on the state of the container.

style.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,70 @@ The redundancy reduction from removing the namespacing prefix is not useful enou
2121
So we have a consistent way to identify unset values ([source][optional-pointer]).
2222
The exceptions are entries where the Go default for the type is a no-op in the spec, in which case `omitempty` is sufficient and no pointer is needed (sources [here][no-pointer-for-slices], [here][no-pointer-for-boolean], and [here][pointer-when-updates-require-changes]).
2323

24+
## Examples
25+
26+
### Anchoring
27+
28+
For any given section that provides a notable example, it is ideal to have it denoted with [markdown headers][markdown-headers].
29+
The level of header should be such that it is a subheader of the header it is an example of.
30+
31+
#### Example
32+
33+
```markdown
34+
## Some Topic
35+
36+
### Some Subheader
37+
38+
#### Further Subheader
39+
40+
##### Example
41+
42+
To use Further Subheader, ...
43+
44+
### Example
45+
46+
To use Some Topic, ...
47+
48+
```
49+
50+
### Content
51+
52+
Where necessary, the values in the example can be empty or unset, but accommodate with comments regarding this intention.
53+
54+
Where feasible, the content and values used in an example should convey the fullest use of the data structures concerned.
55+
Most commonly onlookers will intend to copy-and-paste a "working example".
56+
If the intention of the example is to be a fully utilized example, rather than a copy-and-paste example, perhaps add a comment as such.
57+
58+
```markdown
59+
### Example
60+
```
61+
```json
62+
{
63+
"foo": null,
64+
"bar": ""
65+
}
66+
```
67+
68+
**vs.**
69+
70+
```markdown
71+
### Example
72+
73+
Following is a fully populated example (not necessarily for copy/paste use)
74+
```
75+
```json
76+
{
77+
"foo": [
78+
1,
79+
2,
80+
3
81+
],
82+
"bar": "waffles",
83+
"bif": {
84+
"baz": "potatoes"
85+
}
86+
}
87+
```
2488

2589
[capabilities]: config-linux.md#capabilities
2690
[class-id]: config-linux.md#network
@@ -30,3 +94,4 @@ The exceptions are entries where the Go default for the type is a no-op in the s
3094
[no-pointer-for-slices]: https://github.com/opencontainers/runtime-spec/pull/316/files#r50782982
3195
[optional-pointer]: https://github.com/opencontainers/runtime-spec/pull/233#discussion_r47829711
3296
[pointer-when-updates-require-changes]: https://github.com/opencontainers/runtime-spec/pull/317/files#r50932706
97+
[markdown-headers]: https://help.github.com/articles/basic-writing-and-formatting-syntax/#headings

0 commit comments

Comments
 (0)