Skip to content

Commit 36858c6

Browse files
committed
Mention negative indexing in Snippets documentation
1 parent 271950f commit 36858c6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

docs/src/markdown/extensions/snippets.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@ numbers, simply append the start and/or end to the end of the file name with eac
122122
Each line selection is evaluated independently of previous selections. Selections will be performed in the order
123123
they are specified. No additional separators (empty lines or otherwise) are inserted between selections, they are
124124
inserted exactly as specified.
125+
- Negative indexes can be used as well and will be converted to positive indexes based on the total number of lines
126+
in the snippet. If a snippet has 10 lines, then `-1` would correspond with line `10` and `-10` would correspond with
127+
line `1`.
128+
129+
Be mindful of snippets with trailing, empty new lines at the end as those will be considered as well.
130+
131+
/// note
132+
Lines are never specified with `0`. If `0` is used it will be clamped to `1`.
133+
///
125134

126135
```
127136
;--8<-- "file.md:4:6"
@@ -132,7 +141,7 @@ include.md::3
132141
```
133142

134143
/// new | 10.13
135-
Specifying multiple line selections separated with `,` was added in 10.13.
144+
Specifying multiple line selections separated with `,` and negative indexing was added in 10.13.
136145
///
137146

138147
### Snippet Sections

0 commit comments

Comments
 (0)