Markdent::Parser(3pm)

Markdent::Parser3pm

A markdown parser

Usage

  my $handler = Markdent::Handler::HTMLStream->new( ... );
  my $parser = Markdent::Parser->new(
      dialect => ...,
      handler => $handler,
  );
  $parser->parse( markdown => $markdown );

Version

version 0.40

Overview

This class provides the primary interface for creating a parser. It ties a block and span parser together with a handler.

By default, it will parse the standard Markdown dialect, but you can provide alternate block or span parser classes.

Methods

This class provides the following methods:

Markdent::Parser->new(...)

This method creates a new parser. It accepts the following parameters:

•

dialects => $name or [ $name1, $name2 ]

You can use this to apply dialect roles to the standard parser class.

If a dialect name does not contain a namespace separator (::), the constructor looks for roles named "Markdent::Dialect::${dialect}::BlockParser" and "Markdent::Dialect::${dialect}::SpanParser".

If a dialect name does contain a namespace separator, it is used a prefix - $dialect::BlockParser and $dialect::SpanParser.

If any relevant roles are found, they will be used by the parser.

It is okay if a given dialect only provides a block or span parser, but not both.

•

block_parser_class => $class

This defaults to Markdent::Parser::BlockParser, but can be any class which implements the Markdent::Role::BlockParser role.

•

span_parser_class => $class

This defaults to Markdent::Parser::SpanParser, but can be any class which implements the Markdent::Role::SpanParser role.

•

handler => $handler

This can be any object which implements the Markdent::Role::Handler role. It is required.

$parser->parse( markdown => $markdown )

This method parses the given document. The parsing will cause events to be fired which will be passed to the parser's handler.

Roles

This class does the Markdent::Role::EventsAsMethods and Markdent::Role::Handler roles.

Source

The source code repository for Markdent can be found at <https://github.com/houseabsolute/Markdent>.

Releases

4 releases since Debian 10 (Buster); the text changed 3 times.

  1. 10
  2. 11
  3. 12
  4. 13

Bugs

See Markdent for bug reporting details.

Bugs may be submitted at <https://github.com/houseabsolute/Markdent/issues>.

I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".

Author

Dave Rolsky <[email protected]>

From libmarkdent-perl 0.40-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.