Skip to content

Commit 8d4f782

Browse files
feat: document code fragment rules (#309)
* feat: document code fragment rules This commit adds a basic style guide to the contributing documentation, with rules around how we currently do executable code fragments. Resolves #239 * revert: header level in contributing * revert: change to section header
1 parent 883cda5 commit 8d4f782

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

CONTRIBUTING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,28 @@ mdbook build
5252

5353
Don't forget to remove the changes in `book.toml` before you commit!
5454

55+
## Writing style guide
56+
57+
This section contains what is a *somewhat loosely* applied style guide for writing that is contributed to `component-docs`.
58+
59+
### Executable code fragments
60+
61+
For code that should be executed by the user in their console of choice, prefer using `sh`/`bash`. While not every user's
62+
shell is `sh` or `bash` (with `zsh` being incredilby common), `sh`/`bash` provide a decent approximation.
63+
64+
Importantly, code that is meant to be executed should be copy-pastable -- and should not contain `$` as a prefix. For example:
65+
66+
```sh
67+
echo 'this is an example';
68+
```
69+
70+
On the other hand, when commands *and* output are shown, use `console` and *do* prefix the command with `$` to differentiate it (or `#` in a sudo context):
71+
72+
```console
73+
$ echo 'this is an example';
74+
this is an example
75+
```
76+
5577
## Submitting Changes
5678

5779
You can click the Fork button in the upper-right area of the screen to create a copy of this repository in your GitHub account. This copy is called a fork. Make any changes you want in your fork, and when you are ready to submit those changes, go to your fork and create a new pull request to let us know about it.

0 commit comments

Comments
 (0)