Use `transcript` in `rewriteLeaf`.

See #356.
See #355.
See #107.
See #4.