Every change to a node records in nodes_history what the node was before it: title, Markdown body, sort key and place in the tree, for a deleted node too. The trail shows how a section developed.
Restoring is manual. An earlier body found in the history is copied back into an existing node with patch_node or update_node; a deleted node is created again, under a new id.