Add flag to include pointers in flatten_to_documents.