Improve raised mode and text docus handling