NAME

Text::Markdown::TreeBuilder -- parse Markdown and generate (DOM like) Tree

SYNOPSIS

 use strict;
 use warnings;
 use Text::Markdown::TreeBuilder;

 my $tb=Text::Markdown::TreeBuilder->new(utf8=>1);
 $tb->parse(<<'TXT');
 AT&T has an ampersand in their name.
 =====================================

 AT&amp;T is another way to write it.
 ------------------------------------

 This & that.
 TXT
 print $tb->as_HTML();

DESCRIPTION

Parser for markdown formated Documents

AUTHOR

ToPeG

Overview

the Markdown types are converted to:

 markdown types:    perlclass:
  list_plain     -> HTML::Element "ul"
  list_count     -> HTML::Element "ol"
  list_entry     -> HTML::Element "li"
  h1..h6         -> HTML::Element "h1..h6"
  hr             -> HTML::Element "hr"
  link/linkref   -> HTML::Element "a"
  image/imageref -> HTML::Element "img"
  page           -> HTML::Element "p"
  code           -> HTML::Element "pre" => HTML::Element "code"
  inlinecode     -> HTML::Element "code"
  html           -> HTML::Element ( HTML::TreeBuilder ->look_down('body')->content->[0] )
  inlinehtml     -> HTML::Element ( HTML::TreeBuilder ->look_down('body')->content->[0] )
  quote          -> HTML::Element "blockquote"
  strong         -> HTML::Element "strong"
  em             -> HTML::Element "em"
  break          -> HTML::Element "br"
  comment        -> IGNORED
  link_def       -> IGNORED (only used in Text::Markdown::Parser to Determin imageref and linkref)

all delivered Methods from HTML::Element are usable

METHODS

new(%options)

create a new Parser Object

returns a Text::Markdown::TreeBuilder Object

 type_attr => { type=>{...} }

 default:

 type_attr => {
    inlinecode => {style => "border:0.1em solid gray;" },
    code       => {style => "border:0.1em solid gray; margin-left:2em;" },
    quote      => {style => "border-left:0.3em solid blue; padding-left:0.3em; margin-left:0.6em;" },
  }

set attributes for HTML-Tags

 parser

set your own parser

 parser_tabwidth => <int> (default 4)

set the amount of spaces for one tab

 parser_grep_exessive => 1/0 (default 0)

if this option is true, linlinehtml will gab as mutch as possible text

parser($parser)

set/get parser-opject

utf8(1/0)

set/get UTF-8 conversion

set_type_attributes($type,$param)

set the HTML-Attributes for a markdown type

see type_attr in "new"

parse_file($file)

parse data from a File or Filehandle. See Text::Markdown::Parser

parse($text)

Parse Makdown formated Text. See Text::Markdown::Parser

BUGS

unkown

TODO

- optional warnings

- store/export comments

See also

Text::Markdown::Parser

AUTHOR

Tobias Grönhagen <markdown@topeg.de>

VERSION

Version 0.01 1 January 2011

COPYRIGHT

Copyright (c) Tobias Grönhagen. All rights reserved.

LICENSE

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

This means that you can, at your option, redistribute it and/or modify it under either the terms the GNU Public License (GPL) version 2 or later, or under the Perl Artistic License.

See http://dev.perl.org/licenses/

DISCLAIMER

THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Use of this software in any way or in any form, source or binary, is not allowed in any country which prohibits disclaimers of any implied warranties of merchantability or fitness for a particular purpose or any disclaimers of a similar nature.

IN NO EVENT SHALL I BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION (INCLUDING, BUT NOT LIMITED TO, LOST PROFITS) EVEN IF I HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE