Either use the good old <pre>
tag or, in your CSS, apply white-space: pre;
or white-space: pre-wrap;
to the surrounding element. Personally I think <pre>
is preferable, since it's semantic.
P.S. I would avoid using html_safe
in this instance, as the unescaped output from your shell command could easily break your markup.