Skip to content

Commit d18dbb5

Browse files
msimbergbcumming
andauthored
Add section about using snippets to contributing guide (#255)
Co-authored-by: Ben Cumming <[email protected]>
1 parent 2ab9ffa commit d18dbb5

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/contributing/index.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,3 +488,29 @@ If you want to display commands without output that can easily be copied, use `b
488488
```bash title="Hello, world!"
489489
echo "Hello, world!"
490490
```
491+
492+
### Avoiding repetition using snippets
493+
494+
It can be useful to repeat information on different pages to increase visibility for users.
495+
If possible, prefer linking to a primary section describing a topic instead of fully repeating text on different pages.
496+
However, if you believe it's beneficial to actually repeat the content, consider using [snippets](https://facelessuser.github.io/pymdown-extensions/extensions/snippets/) to avoid repeated information getting out of sync on different pages.
497+
Snippets allow including the contents of a text file in multiple places of the documentation.
498+
499+
For example, the recommended NCCL environment variables are defined in a text file [`docs/software/commuinication/nccl_env_vars`](https://github.com/eth-cscs/cscs-docs/blob/main/docs/software/communication/nccl_env_vars) and included on multiple pages because it's essential that users of NCCL notice and use the environment variables.
500+
501+
Snippets are included with `--8<-- path/to/snippet`.
502+
For example, to include the recommended NCCL environment variables, do the following:
503+
504+
=== "Markdown"
505+
506+
````markdown
507+
```bash
508+
;--8<-- "docs/software/communication/nccl_env_vars"
509+
```
510+
````
511+
512+
=== "Rendered"
513+
514+
```bash title="Recommended NCCL environment variables"
515+
--8<-- "docs/software/communication/nccl_env_vars"
516+
```

0 commit comments

Comments
 (0)