Now with extra flavour! PerlMonks-ish links, finer control over header tags, italic, strikethrough and teletype text for your HTML-hating enjoyment!
--- /usr/local/lib/perl5/site_perl/5.005/HTML/FromText.pm Wed Oc +t 6 04:53 :37 1999 +++ FromText.pm Sat Sep 7 16:26:57 2002 @@ -85,6 +85,24 @@ s|\b((?:$protocol):\S+[\w/])|<TT><A HREF="$1">$1</A></TT>|g; } + # PATCH + # NAMED URLS: mark up named URLs of the form [url name]. Do this + only + # if urls isn't set. + # Matt Olson June 2nd 2002 + if ($options->{named_urls} and !$options->{urls}) { + s|\[((?: + (?:$protocol) # match a possible protocol + :// # followed by this thing + )? + \S+ # followed by the URL, until a space + ) + \s+ # ignore whitespace + ([^\]]+) # read description text until trailing ] + \] + |<A HREF="$1">$2</A>|xg; + } + # END PATCH + # BOLD: mark up words in *asterisks* as bold. if ($options->{bold}) { s#(^|\s)\*([^*]+)\*(?=\s|$)#$1<B>$2</B>#g; @@ -94,6 +112,31 @@ if ($options->{underline}) { s#(^|\s)_([^_]+?)_(?=\s|$)#$1<U>$2</U>#g; } + + # PATCH + # ITALICS: mark up words between /slashes/ as italicized. + # If underline isn't set, do the same for words in _underscores_. + # Matt Olson, June 1st 2002 + if ($options->{italics}) { + s#(^|\s)/([^/]+?)/(?=\s|$)#$1<I>$2</I>#g; + if (!$options->{underline}) { + s#(^|\s)_([^_]+?)_(?=\s|$)#$1<I>$2</I>#g; + } + } + + # FIXED-WIDTH: mark up words between +plusses+ as fixed-width. + # (Mnemonic: '+' looks like a 't' in <tt> + # Matt Olson, June 28th 2002 + if ($options->{fixed_width}) { + s#(^|\s)\+([^\+]+?)\+(?=\s|$)#$1<TT>$2</TT>#g; + } + + # STRIKE-THROUGH: mark up words between -hyphens- as struck throu +gh. + # Matt Olson, June 28th 2002 + if ($options->{strike_through}) { + s#(^|\s)\-([^\-]+?)\-(?=\s|$)#$1<STRIKE>$2</STRIKE>#g; + } + # END PATCH } return $_[0]; @@ -182,6 +225,17 @@ (?:\s*\n # Either 1 or more blank lines, +or |(?=\s*(?:\d+)[.\)\]]?\s+)) # numbered item follows. /x; + # PATCH + # Headers + # Recognize leading #N as a level-N header, and markup *-led para +s as + # H4s. + # Matt Olson, 2002 June 3 + } elsif ($options{headers}) { + @paras = split + /(?:\s*\n)+ # (0 or more blank lines, followe +d by LF) + (?:\s*\n # Either 1 or more blank lines, +or + |(?=\s*(?:\#\d|[*-])\s+)) # headered item follows. + /x; } else { @paras = split /\s*\n(?:\s*\n)+ # 1 or more blank lines. @@ -213,6 +267,18 @@ s|^|<H$level>|; s|$|</H$level>|; } + + # PATCH + # HEADERS: mark up paragraphs starting with bullets or #N as he +adings. + # Matt Olson, 2002 June 3 + elsif ($options{headers} and /^\s*(\#\d|[*-])\s+/) { + my ($level) = ($1 =~ /(\d)/); + $level = 4 unless $level; + string2html($_,\%options); + s/^\s*(?:\#\d|[*-])\s+/<H$level>/; + s/$/<\/H$level>/; + } + # END PATCH # BULLETS: mark up paragraphs starting with bullets as items in + an # unnumbered list.

In reply to HTML::FromText patch by FoxtrotUniform

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.