Title: @wordpress/block-serialization-spec-parser
Published: March 9, 2021
Last modified: October 14, 2026

---

# @wordpress/block-serialization-spec-parser

## In this article

 * [Installation](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-serialization-spec-parser/?output_format=md#installation)
 * [Usage](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-serialization-spec-parser/?output_format=md#usage)
 * [Contributing to this package](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-serialization-spec-parser/?output_format=md#contributing-to-this-package)

This library contains the grammar file (`grammar.pegjs`) for WordPress posts which
is a block serialization _specification_ which is used to generate the actual _parser_
which is also bundled in this package.

PEG parser generators are available in many languages, though different libraries
may require some translation of this grammar into their syntax. For more information
see:

 * [PEG.js](https://github.com/pegjs/pegjs)
 * [Parsing expression grammar](https://en.wikipedia.org/wiki/Parsing_expression_grammar)

## 󠀁[Installation](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-serialization-spec-parser/?output_format=md#installation)󠁿

Install the module

    ```bash
    npm install @wordpress/block-serialization-spec-parser --save
    ```

## 󠀁[Usage](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-serialization-spec-parser/?output_format=md#usage)󠁿

    ```javascript
    import { parse } from '@wordpress/block-serialization-spec-parser';

    parse( '<!-- wp:core/more --><!--more--><!-- /wp:core/more -->' );
    // [{"attrs": null, "blockName": "core/more", "innerBlocks": [], "innerHTML": "<!--more-->"}]
    ```

## 󠀁[Contributing to this package](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-serialization-spec-parser/?output_format=md#contributing-to-this-package)󠁿

This is an individual package that’s part of the Gutenberg project. The project 
is organized as a monorepo. It’s made up of multiple self-contained software packages,
each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/)
and used by [WordPress](https://make.wordpress.org/core/) as well as other software
projects.

To find out more about contributing to this package or Gutenberg as a whole, please
read the project’s main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).

First published

March 9, 2021

Last updated

October 14, 2026

Edit article

[ Improve it on GitHub: @wordpress/block-serialization-spec-parser ](https://github.com/WordPress/gutenberg/edit/trunk/packages/block-serialization-spec-parser/README.md)

[  Previous: @wordpress/block-serialization-default-parser](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-serialization-default-parser/)

[  Next: @wordpress/blocks](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blocks/)