Skip to content

Commit 486b5e8

Browse files
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
1 parent 519a0c5 commit 486b5e8

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

CONTRIBUTING.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The Component Model documentation is a [Bytecode Alliance](https://bytecodeallia
66

77
You can run the website locally using the [mdBook](https://rust-lang.github.io/mdBook/index.html) command line tool.
88

9-
### Prerequisites
9+
## Prerequisites
1010

1111
To use this repository, you need [mdBook](https://rust-lang.github.io/mdBook/guide/installation.html) installed on your workstation.
1212

@@ -20,7 +20,7 @@ cargo install --version 0.7.7 mdbook-linkcheck
2020

2121
[cargo]: https://doc.rust-lang.org/cargo
2222

23-
### Running the website locally
23+
## Running the website locally
2424

2525
After installing mdBook, you'll need to clone the code via git and navigate to the directory.
2626

@@ -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)