document code generation