Skip to content
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

Add: some readme documentation on snippets #97

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,23 @@ It also means being open to feedback yourself, and being willing to learn from o

It should be noted that this also means that sometimes pull requests will be rejected.
A rejection does not mean that your contribution is not valued, but rather that it is not a good fit for the project at this point in time.

# Conventions

## Snippets

There are various places where we insert code snippets into the documentation to better visualize what's going on.

Snippets are placed in the `snippets` folder, grouped in subfolders by topic. Each snippet is a separate file per language (based off of its extension), with a central (autogenerated) `.md` file that includes the snippets for each language. If you want to add a new language to a snippet, create the new file, and the build pipeline will automatically include it in the final documentation.

If you are adding the first snippet for a new language, it will need to be defined in `scripts/generate-snippets.py`, so that the build pipeline knows to include the file extension when searching for snippets, and what langauge to use for syntax highlighting.

When adding new snippets, write it in any supported/configured language, and include it as follows:

```markdown
--8<-- "snippets/path/to-filename.md"
```

Note the .md extension to use the autogenerated file, and the `--8<--` to indicate that this is a snippet include.

If a certain topic contains a lot of snippets, it might also be time to create a guide page for that topic, so that newer users can use that guide as a starting point.
Loading