Add syntax highlighting to all examples
diff --git a/SliceTricks.md b/SliceTricks.md
index 157f536..773f8f5 100644
--- a/SliceTricks.md
+++ b/SliceTricks.md
@@ -3,12 +3,12 @@
Here are the vector methods and their slice-manipulation analogues:
**AppendVector**
-```
+```go
a = append(a, b...)
```
**Copy**
-```
+```go
b = make([]T, len(a))
copy(b, a)
// or
@@ -16,24 +16,25 @@
```
**Cut**
-```
+```go
a = append(a[:i], a[j:]...)
```
**Delete**
-```
+```go
a = append(a[:i], a[i+1:]...)
// or
a = a[:i+copy(a[i:], a[i+1:])]
```
**Delete without preserving order**
-```
+```go
a[i], a = a[len(a)-1], a[:len(a)-1]
+
```
**NOTE** If the type of the element is a _pointer_ or a struct with pointer fields, which need to be garbage collected, the above implementations of ` Cut ` and ` Delete ` have a potential _memory leak_ problem: some elements with values are still referenced by slice ` a ` and thus can not be collected. The following code can fix this problem:
> **Cut**
-```
+```go
copy(a[i:], a[j:])
for k, n := len(a)-j+i, len(a); k < n; k++ {
a[k] = nil // or the zero value of T
@@ -42,7 +43,7 @@
```
> **Delete**
-```
+```go
copy(a[i:], a[i+1:])
a[len(a)-1] = nil // or the zero value of T
a = a[:len(a)-1]
@@ -51,54 +52,54 @@
```
> **Delete without preserving order**
-```
+```go
a[i], a[len(a)-1], a = a[len(a)-1], nil, a[:len(a)-1]
```
**Expand**
-```
+```go
a = append(a[:i], append(make([]T, j), a[i:]...)...)
```
**Extend**
-```
+```go
a = append(a, make([]T, j)...)
```
**Insert**
-```
+```go
a = append(a[:i], append([]T{x}, a[i:]...)...)
```
**NOTE** The second ` append ` creates a new slice with its own underlying storage and copies elements in ` a[i:] ` to that slice, and these elements are then copied back to slice ` a ` (by the first ` append `). The creation of the new slice (and thus memory garbage) and the second copy can be avoided by using an alternative way:
> **Insert**
-```
+```go
s = append(s, 0)
copy(s[i+1:], s[i:])
s[i] = x
```
**InsertVector**
-```
+```go
a = append(a[:i], append(b, a[i:]...)...)
```
**Pop**
-```
+```go
x, a = a[len(a)-1], a[:len(a)-1]
```
**Push**
-```
+```go
a = append(a, x)
```
**Shift**
-```
+```go
x, a := a[0], a[1:]
```
**Unshift**
-```
+```go
a = append([]T{x}, a...)
```
@@ -107,7 +108,7 @@
This trick uses the fact that a slice shares the same backing array and capacity as the original, so the storage is reused for the filtered slice. Of course, the original contents are modified.
-```
+```go
b := a[:0]
for _, x := range a {
if f(x) {