LilyPond Contributor's Guide: 7.2 Adding and editing snippets

## 7.2 Adding and editing snippets

### General guidelines

When you create (or find!) a nice snippet, if it supported by LilyPond version running on LSR, please add it to LSR. Go to LSR and log in – if you haven’t already, create an account. Follow the instructions on the website. These instructions also explain how to modify existing snippets.

If you think the snippet is particularly informative and you think it should be included in the documentation, tag it with “docs” and one or more other categories, or ask somebody who has editing permissions to do it on the development list.

Please make sure that the lilypond code follows the guidelines in LilyPond formatting.

If a new snippet created for documentation purposes compiles with LilyPond version currently on LSR, it should be added to LSR, and a reference to the snippet should be added to the documentation.

If the new snippet uses new features that are not available in the current LSR version, the snippet should be added to ‘`Documentation/snippets/new`’ and a reference should be added to the manual.

Snippets created or updated in ‘`Documentation/snippets/new`’ should be copied to ‘`Documentation/snippets`’ by invoking at top of the source tree

>     scripts/auxiliar/makelsr.py

This also copies translated texidoc fields and snippet titles into snippets in ‘`Documentation/snippets`’. Note: this, in turn, could make the translated texidoc fields to appear as out of sync when you run `make check-translation`, if the originals changed from the last translation update, even if the translations are also updated; see Documentation translation maintenance for details about updating the docs; in particular, see Updating translation committishes to learn how to mark these translated fields as fully updated.

Be sure that `make doc` runs successfully before submitting a patch, to prevent breaking compilation.

### Formatting snippets in ‘`Documentation/snippets/new`’

When adding a file to this directory, please start the file with

>     \version "2.x.y"
>     \header {
>     % Use existing LSR tags other than 'docs'; see makelsr.py for
>     % the list of tags used to sort snippets.  E.g.:
>       lsrtags = "rhythms,expressive-marks"
>     % This texidoc string will be formatted by Texinfo
>       texidoc = "
>     This code demonstrates ...
>     "
>     % Please put doctitle last so that the '% begin verbatim'
>     % mark will be added correctly by makelsr.py.
>       doctitle = "Snippet title"
>     }

\noindent and name the file ‘`snippet-title.ly`’.

#### LilyPond — Contributor’s Guide