Add apigen.neon for API docs and improve API documentation

Adds apigen.neon for describing how API docs should be generated. Includes various additions and cleanup on doc blocks. Includes some code changes encountered while updating docs as well.