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

It’s also possible to use backticks (``` + txt), which will keep the formatting, but you might not like the styling

Or in rich text editor:

becomes:

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

And if you have access to TC, you could add some small CSS to mitigate it:

code.lang-txt, pre code.lang-txt {
  font-family: cursive;
  font-size: inherit;
  background: transparent;
  color: inherit;
}
pre:has(code.lang-txt) {
  background: transparent;
  border: none;
  padding: 0;
}

Which looks like (for example):

Typing ``` is an easy skill to teach and likely becomes a habit fast.