Refactor doc plugin