How to use @wordpress/block-serialization-default-parser - 1 common examples

To help you get started, we’ve selected a few @wordpress/block-serialization-default-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WordPress / gutenberg / test / integration / full-content / full-content.spec.js View on Github external
it( basename, () => {
			const {
				filename: htmlFixtureFileName,
				file: htmlFixtureContent,
			} = getBlockFixtureHTML( basename );
			if ( htmlFixtureContent === null ) {
				throw new Error(
					`Missing fixture file: ${ htmlFixtureFileName }`
				);
			}

			const {
				filename: parsedJSONFixtureFileName,
				file: parsedJSONFixtureContent,
			} = getBlockFixtureParsedJSON( basename );
			const parserOutputActual = grammarParse( htmlFixtureContent );
			let parserOutputExpectedString;
			if ( parsedJSONFixtureContent ) {
				parserOutputExpectedString = parsedJSONFixtureContent;
			} else if ( process.env.GENERATE_MISSING_FIXTURES ) {
				parserOutputExpectedString = JSON.stringify(
					parserOutputActual,
					null,
					4
				) + '\n';
				writeBlockFixtureParsedJSON( basename, parserOutputExpectedString );
			} else {
				throw new Error(
					`Missing fixture file: ${ parsedJSONFixtureFileName }`
				);
			}

@wordpress/block-serialization-default-parser

Block serialization specification parser for WordPress posts.

GPL-2.0-or-later
Latest version published 12 days ago

Package Health Score

95 / 100
Full package analysis

Popular @wordpress/block-serialization-default-parser functions