By default AnsPress sanitize and preserve code in question and answer, but code button and syntax highlighter is not there by default. To get this enabled you have to follow below steps.
- Install Crayon Syntax Highlighter plugin and activate it. Go to http://YOUR_DOMAIN.com/wp-admin/options-general.php?page=crayon_settings.
- Find Decode HTML entities in code and check checkbox.
- Find Display the Tag Editor in any TinyMCE instances on the frontend (e.g. bbPress) check checkbox.
- Find Display Tag Editor settings on the frontend uncheck checkbox.
- And finally save the option.
After completing above steps you can see code button in ask and answer form. Let us know if need more help http://anspress.io/questions/ask/