20.4.3. Discussion
Converting arbitrary plain text to HTML has no general solution
because there are too many conflicting ways to represent formatting
information. The more you know about the input, the better you can
format it.
For example, if you knew that you would be fed a mail message, you
could add this block to format the mail headers:
BEGIN {
print "<TABLE>";
$_ = encode_entities(scalar <>);
s/\n\s+/ /g; # continuation lines
while ( /^(\S+?:)\s*(.*)$/gm ) { # parse heading
print "<TR><TH ALIGN='LEFT'>$1</TH><TD>$2</TD></TR>\n";
}
print "</TABLE><HR>";
}