1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v.doc: parse multi-line examples (so they get highlighted) (#13894)

This commit is contained in:
Nick Treleaven
2022-04-02 16:29:12 +01:00
committed by GitHub
parent faa55b46de
commit 42f92db0ab
4 changed files with 63 additions and 11 deletions

View File

@ -175,7 +175,7 @@ pub struct WindowAttribute {
// - `size` - snapshot size
// - `step` - gap size between each snapshot, default is 1.
//
// Example: arrays.window([1, 2, 3, 4], size: 2) => [[1, 2], [2, 3], [3, 4]]
// Example: arrays.window([1, 2, 3, 4], size: 2) // => [[1, 2], [2, 3], [3, 4]]
// Example: arrays.window([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], size: 3, step: 2) // => [[1, 2, 3], [3, 4, 5], [5, 6, 7], [7, 8, 9]]
pub fn window<T>(list []T, attr WindowAttribute) [][]T {
// allocate snapshot array
@ -394,7 +394,7 @@ pub fn binary_search<T>(arr []T, target T) ?int {
// Example:
// ```v
// mut x := [1,2,3,4,5,6]
// arrays.rotate_left(mut x,2)
// arrays.rotate_left(mut x, 2)
// println(x) // [3, 4, 5, 6, 1, 2]
// ```
pub fn rotate_left<T>(mut arr []T, mid int) {