Markdent::Parser(3pm)

πŸ“¦
version 0.40 Β· 2 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’– Markdent::Parser πŸ’–

okay bestie, gather round, because this is the one. this is Markdent::Parser, a markdown parser, and it's giving main character energy from the very first line. ✨

this is version 0.40, just so we're both on the same page. πŸŽ€


🌸 SYNOPSIS 🌸

like, here's the vibe in code form:

my $handler = Markdent::Handler::HTMLStream->new( ... );

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

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

no notes. iconic. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so this class is the primary interface for making a parser. that's the whole girlboss job. it takes a block parser and a span parser and ties them together with a handler β€” like a little friendship bracelet of parsing. 🫢

by default, it parses the standard Markdown dialect, no cap. but you can hand it alternate block parser or span parser classes if you're feeling spicy. πŸ”₯


πŸ‘‘ METHODS πŸ‘‘

here's what this class can do for you, bestie:

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 doesn't 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 gets used as a prefix β€” $dialect::BlockParser and $dialect::SpanParser. if any relevant roles are found, the parser uses them. and it's totally okay if a given dialect only provides a block parser or a span parser, but not both. we don't gatekeep. 🌈
  • block_parser_class => $class β€” this defaults to Markdent::Parser::BlockParser, but honestly it can be any class that implements the Markdent::Role::BlockParser role. your choice, your rules. πŸ’œ
  • span_parser_class => $class β€” this defaults to Markdent::Parser::SpanParser, but it can be any class that implements the Markdent::Role::SpanParser role. slay. ✨
  • handler => $handler β€” this can be any object that implements the Markdent::Role::Handler role. it is required, so don't forget it, fr fr. 😭

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

this method parses the given document. the parsing will cause events to be fired, and those events get passed to the parser's handler. it's giving cause and effect. πŸ’«


🧚 ROLES 🧚

this class does the Markdent::Role::EventsAsMethods and Markdent::Role::Handler roles. iykyk. πŸ’…


πŸ’€ BUGS πŸ’€

see Markdent for bug reporting details.

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

i'm also usually active on IRC as 'autarch' on "irc://irc.perl.org". come say hi. 🫢


πŸ“ SOURCE πŸ“

the source code repository for Markdent can be found at <https://github.com/houseabsolute/Markdent>. go look, bestie. πŸ‘‘


⭐ AUTHOR ⭐

Dave Rolsky <autarch@urth.org> πŸŽ€


this software is copyright (c) 2021 by Dave Rolsky.

this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

the full text of the license can be found in the LICENSE file included with this distribution.


and that's the whole page, bestie! πŸŽ‰ this gorgeous little manual came from perl v5.32.1, dated 2021-08-31, and it lives at Markdent::Parser(3pm) β€” go forth and parse, you absolute icon. πŸŒŸπŸ’…βœ¨

πŸ“¦ where this page comes from