Hi Lindsey , I would recommend using the code sampler plugin to insert code in RTE mode itself. This is specifically designed and built for use cases where community users want to share code samples.
If for some reasons, user still needs to manipulate the html, then please refer to Allowed HTML Tags in the Community text editor for details of html tags allowed.