The Autop is a simple Gutenberg module which add or remove the <p> tags from the provided content.
Installation Installation
npm install @wordpress/autop --save
Usage Usage
Using the autop function Using the autop function
import { autop } from '@wordpress/autop';
autop( 'Hello World' );
The above code convert the string ‘
Hello World’.
Using the removep function Using the removep function
import { removep } from '@wordpress/autop';
removep( '<p>Hello World</p>' );
The above code convert the string ‘Hello World’.