Search code examples
htmltelnet

Preserve Telnet output formatting when displayed in HTML


I have an output from a telnet connection. Looks similar to this

ACTIVE ALARMS REPORT

ID  CATEGORY  DESCRIPTION          ALARM TYPE             DATE    TIME

When I save this information to an HTML doc the results look like this:

ACTIVE ALARMS REPORT ID CATEGORY DESCRIPTION ALARM TYPE DATE TIME 

Is there a way to make this code spaced out just how the telnet output is? Is this more of a css question?

The key here is I use python to pull the information from telnet and pass the information to the html doc.


Solution

  • Wrap your text in <pre></pre> tags to preserve formatting such as newlines, tabs, and multiple spaces.