Either of those options should work for you. Code blocks are almost always rendered with monospace fonts and manually setting a normal block of text to a monospaced font will do what you want as well.
The only other issue I can see is if your diagram is too large it might start wrapping which will break the “image” you are going for.
EDIT: See my sibling comment for examples of how to do this.