Is there a simple way to not strip leading spaces and other formatting in a poem?

hi @pinetree1111 :wave: welcome

not sure if you consider this “easy” but i find it easy because i use them in my posts occasionally lol.

you can use   (non-breaking space) for blank space:
like this

hello world
 this is a line with a leading space
  this is a line with 2 leading spaces
   this is a line with 3 leading spaces

code:

hello world
 this is a line with a leading space
  this is a line with 2 leading spaces
   this is a line with 3 leading spaces

you can also put spaces between them

hello world
  this is a line with 2 leading spaces
    this is a line with 4 leading spaces
      this is a line with 6 leading spaces

hello world
  this is a line with 2 leading spaces
    this is a line with 4 leading spaces
      this is a line with 6 leading spaces