CommonMark::Parser(3)

πŸ’– CommonMark::Parser πŸ’–

ok so bestie, welcome to CommonMark::Parser β€” that's the module name, and it lives in the Perl man pages (section 3, for the nerds keeping track πŸŽ€). It's a push parser interface, and honestly? it's giving ✨main character energy✨ for anyone who wants to feed Markdown in little chunks instead of all at once.


✨ SYNOPSIS ✨

my $parser = CommonMark::Parser->new;
$parser->feed($string);
$parser->feed($another_string);
my $doc = $parser->finish;

that's it. that's the whole vibe. feed it, feed it again, then finish and boom πŸ’…


🌸 DESCRIPTION 🌸

CommonMark::Parser hands you a push parser interface to parse CommonMark documents. so instead of dumping your whole document at it and hoping for the best, you push bits of it in whenever you feel like it. iconic behaviour, no cap πŸ¦‹

πŸŽ€ new

my $parser = CommonMark::Parser->new( [$options] );

makes you a shiny new parser object 🫢

$options is a bit field holding the parser options. if you don't pass anything, it defaults to zero, which is OPT_DEFAULT. and if you wanna know what all those options actually are, go peek at "Parser options" in CommonMark. iykyk πŸ‘‘

🧚 feed

$parser->feed($string);

feeds a part of the input Markdown to the parser. that's the whole job. one bite at a time, bestie πŸ“

πŸ’œ finish

my $doc = $parser->finish;

this one parses a CommonMark document out of all the strings you added with feed, and it returns the CommonMark::Node of the document root. the moment we've all been waiting for, fr fr 🌈


this software is copyright (C) by Nick Wellnhofer. respect the icon πŸ’…

it's free software β€” you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, open source, we love to see it 🌸


and that's the page, bestie πŸŽ€ this was CommonMark::Parser(3) from the User Contributed Perl Documentation, generated by perl v5.42.0, dated 2025-07-25. go feed a parser something nice βœ¨πŸ’–

πŸ“¦ where this page comes from