How to repair shelf edge tape

The edge tape on shelves often cracks, chips or peels off. The repair can be done with the shelf in or out of the cupboard.
+