Add option to pass function as `captions`

This allows the user to retrieve the caption from e.g. a different DOM
element.
Create new version