---
name: "CommonMark::Parser"
section: "3pm"
platform: "linux"
package: "libcommonmark-perl"
version: "0.310100-1+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/CommonMark::Parser"
---

# CommonMark::Parser(3pm)

Push parser interface

## NAME

CommonMark::Parser - Push parser interface

## SYNOPSIS

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

## DESCRIPTION

`"CommonMark::Parser"` provides a push parser interface to parse CommonMark documents.

### new

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

Creates a parser object. `$options` is a bit field containing the parser options. It defaults to zero (`"OPT_DEFAULT"`). See "Parser options" in CommonMark.

### feed

```
    $parser->feed($string);
```

Feeds a part of the input Markdown to the parser.

### finish

```
    my $doc = $parser->finish;
```

Parses a CommonMark document from the strings added with `"feed"` returning the CommonMark::Node of the document root.

## COPYRIGHT

This software is copyright (C) by Nick Wellnhofer.

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