-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Anchor examples #348
Anchor examples #348
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,70 @@ The redundancy reduction from removing the namespacing prefix is not useful enou | |
So we have a consistent way to identify unset values ([source][optional-pointer]). | ||
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]). | ||
|
||
## Examples | ||
|
||
### Anchoring | ||
|
||
For any given section that provides a notable example, it is ideal to have it denoted with [markdown headers][markdown-headers]. | ||
The level of header should be such that it is a subheader of the header it is an example of. | ||
|
||
#### Example | ||
|
||
```markdown | ||
## Some Topic | ||
|
||
### Some Subheader | ||
|
||
#### Further Subheader | ||
|
||
##### Example | ||
|
||
To use Further Subheader, ... | ||
|
||
### Example | ||
|
||
To use Some Topic, ... | ||
|
||
``` | ||
|
||
### Content | ||
|
||
Where necessary, the values in the example can be empty or unset, but accommodate with comments regarding this intention. | ||
|
||
Where feasible, the content and values used in an example should convey the fullest use of the data structures concerned. | ||
Most commonly onlookers will intend to copy-and-paste a "working example". | ||
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. | ||
|
||
```markdown | ||
### Example | ||
``` | ||
```json | ||
{ | ||
"foo": null, | ||
"bar": "" | ||
} | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is supposed to be a copy/paste example, but it's lacking the comment you call for above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. k There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
**vs.** | ||
|
||
```markdown | ||
### Example | ||
|
||
Following is a fully populated example (not necessarily for copy/paste use) | ||
``` | ||
```json | ||
{ | ||
"foo": [ | ||
1, | ||
2, | ||
3 | ||
], | ||
"bar": "waffles", | ||
"bif": { | ||
"baz": "potatoes" | ||
} | ||
} | ||
``` | ||
|
||
[capabilities]: config-linux.md#capabilities | ||
[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 | |
[no-pointer-for-slices]: https://github.com/opencontainers/runtime-spec/pull/316/files#r50782982 | ||
[optional-pointer]: https://github.com/opencontainers/runtime-spec/pull/233#discussion_r47829711 | ||
[pointer-when-updates-require-changes]: https://github.com/opencontainers/runtime-spec/pull/317/files#r50932706 | ||
[markdown-headers]: https://help.github.com/articles/basic-writing-and-formatting-syntax/#headings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this would be a more canonical link, but both are likely authoritative enough for this situation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe clarify that this is an example of “some topic”. And if we prefer Sentence casing or Title Casing, it's probably best to use that throughout this Markdown literal as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @wking. I was confused on first read of lines 28-34 until I read Trevor's comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not all what we do today.