Book formatting: Handle line endings as per vanilla, fix tall images causing infinite loop, cleanup