text2xhtml - Utility to convert plain text to HTML


  text2xhtml --title 'Read Me' < README > readme.html
  text2xhtml --body-only < disclaimer.txt > ssi/disclaimer.html
  echo '(c) Bruno Postle -- 2005' | text2xhtml --entities-only > ssi/copy.html


`text2xhtml' is a command-line utility program for converting simple plain text into valid XHTML files or fragments. It uses the MKDoc::Text::Structured library to handle the conversion, so standard plain text formatting conventions such as asterisks for bulleted lists, dashes to underline a headline and two carriage returns to start a new paragraph are supported.

Lots of other standard 'email' type formatting is supported, see the MKDoc::Text::Structured documentation for more details:

Calling syntax

  text2xhtml [-h] [-v] [--external-stylesheet <path>] [--title <title>] [--body-only|--inline-only|--entities-only]



The -h option will display a short usage summary.


This option displays the version number of MKDoc::Text::Structured

--external-stylesheet <path>

Use this option to specify an external stylesheet, this can be a relative path, or an absolute URL. This option has no effect when producing XHTML fragments with any of the --body-only, --inline-only or --entities-only options.

--title <title>

Use this option to set the page title. If ommitted, the <title> tag is left empty. This option has no effect when producing XHTML fragments with any of the --body-only, --inline-only or --entities-only options.


Output the fragment of text normally found inside the <body> tag. This fragment will include block level tags such as <p> and <ul>, but since it has no enclosing tag is not well-formed XML.


Don't create any block-level tags, this will create a fragment with inline tags such as <strong> or <abbr>, but no block level tags such as <p> or <ul>.


Don't create any tags at all, this will still convert various constructs in the fragment to HTML entities such as &amp; &gt; &emdash; &copy; etc.. but will not generate any HTML tags such as <p> or <strong>.


This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See Also

perl, MKDoc::Text::Structured


Bruno Postle, <bruno (at)>