++ed by:
David Iberri


HTML::WikiConverter - Convert HTML to wiki markup


  use HTML::WikiConverter;
  print $wc->html2wiki( html => '<b>text</b>' ), "\n\n";

  # A more complete example

  my $html = qq(
    <p><i>Italic</i>, <b>bold</b>, <span style="font-weight:bold">also bold</span>, etc.</p>

  my @dialects = HTML::WikiConverter->available_dialects;
  foreach my $dialect ( @dialects ) {
    my $wc = new HTML::WikiConverter( dialect => $dialect );
    my $wiki = $wc->html2wiki( html => $html );
    printf "The %s dialect gives:\n\n%s\n\n", $dialect, $wiki;














  my $ancestor = $wc->elem_search_lineage( $node, \%rules );

Searches the lineage of $node and returns the first ancestor node that has rules matching those specified in %rules, or undef if no matching node is found.

For example, to find out whether $node has an ancestor with rules matching { block =>1 }, one could use:

  if( $wc->elem_search_lineage( $node, { block => 1 } ) ) {
    # do something


  my $html = $wc->given_html;



  my $parsed_html = $wc->parsed_html;

Returns a string containing the post-processed HTML from the last html2wiki call. Post-processing includes parsing by HTML::TreeBuilder, CSS normalization by HTML::WikiConverter::Normalizer, and calls to the preprocess and preprocess_tree dialect methods.


  my @dialects = HTML::WikiConverter->available_dialects;




Returns the rules that will be used for converting elements of the given tag. Follows alias references. Note that the rules used for a particular tag may depend on the current set of attributes being used.











Passing escape_entities a true value uses HTML::Entities to encode potentially unsafe '<', '>', and '&' characters. Defaults to true.


Boolean indicating whether HTML::TreeBuilder will use strict handling of paragraph tags when parsing HTML input. (This corresponds to the p_strict method in the HTML::TreeBuilder module.) Enabled by default.















If wiki_uri is a string, it is interpreted as a URI template, and it will be assumed that URIs to wiki pages are created by joining wiki_uri with the wiki page title. For example, the English Wikipedia might use "http://en.wikipedia.org/wiki/" as the value of wiki_uri. Ward's wiki might use "http://c2.com/cgi/wiki?". These examples use an absolute wiki_uri, but a relative URI can be used as well; an absolute URI will be created based on the value of base_uri. For example, the Wikipedia example above can be rewritten using base_uri of "http://en.wikipedia.org" and a wiki_uri of "/wiki/".




  my $wc = new HTML::WikiConverter(
    dialect => 'MediaWiki',
    wiki_uri => [






HTML::Tree, Convert::Wiki


David J. Iberri, <diberri@cpan.org>


Please report any bugs or feature requests to bug-html-wikiconverter at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-WikiConverter. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc HTML::WikiConverter

You can also look for information at:






Copyright (c) David J. Iberri, all rights reserved.


Hosting generously
sponsored by Bytemark