How to use @wordpress/autop - 9 common examples

To help you get started, we’ve selected a few @wordpress/autop 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 / blocks / api / parser.js View on Github external
// Convert 'core/text' blocks in existing content to 'core/paragraph'.
	if ( 'core/text' === name || 'core/cover-text' === name ) {
		name = 'core/paragraph';
	}

	// Try finding the type for known block name, else fall back again.
	let blockType = getBlockType( name );

	const fallbackBlock = getUnknownTypeHandlerName();

	// Fallback content may be upgraded from classic editor expecting implicit
	// automatic paragraphs, so preserve them. Assumes wpautop is idempotent,
	// meaning there are no negative consequences to repeated autop calls.
	if ( name === fallbackBlock ) {
		innerHTML = autop( innerHTML ).trim();
	}

	if ( ! blockType ) {
		// If detected as a block which is not registered, preserve comment
		// delimiters in content of unknown type handler.
		if ( name ) {
			innerHTML = getCommentDelimitedContent( name, attributes, innerHTML );
		}

		name = fallbackBlock;
		blockType = getBlockType( name );
	}

	// Coerce inner blocks from parsed form to canonical form.
	innerBlocks = innerBlocks.map( createBlockWithFallback );
github ampproject / amp-wp / assets / src / settings-page / plugin-suppression.js View on Github external
}
										 )
										: (
											/* translators: placeholder is an author name. */
											sprintf( __( 'By %s' ), pluginDetails.Author )
										)
									}

								
							<p></p>
						),
						pluginDetails.Description &amp;&amp; (
							<div>
						),

					].filter( ( child ) =&gt; child ) }

				
			
			
				{
					isOriginallySuppressed ? (
						<p>
							
							{ ' ' }
							
							{ ' ' }
							</p></div>
github Yoast / YoastSEO.js / src / worker / AnalysisWebWorker.js View on Github external
analyze( id, { paper, relatedKeywords = {} } ) {
		// Automatically add paragraph tags, like Wordpress does, on blocks padded by double newlines or html elements.
		paper._text = autop( paper._text );
		paper._text = string.removeHtmlBlocks( paper._text );
		const paperHasChanges = this._paper === null || ! this._paper.equals( paper );
		const shouldReadabilityUpdate = this.shouldReadabilityUpdate( paper );

		if ( paperHasChanges ) {
			this._paper = paper;
			this._researcher.setPaper( this._paper );

			// Update the configuration locale to the paper locale.
			this.setLocale( this._paper.getLocale() );
		}

		if ( this._configuration.keywordAnalysisActive && this._seoAssessor ) {
			if ( paperHasChanges ) {
				this._seoAssessor.assess( this._paper );
github pods-framework / pods / ui / js / dfv / src / components / field-option.js View on Github external
const helpTextString = Array.isArray( helpText ) ? helpText[ 0 ] : helpText;
	const helpLink = ( Array.isArray( helpText ) &amp;&amp; !! helpText[ 1 ] )
		? helpText[ 1 ]
		: undefined;

	return (
		<div>
			{ 'heading' !== fieldType &amp;&amp; (
				<div name="">
					<label name="">
						<span>
						{ required &amp;&amp; ( <span>{ '\u00A0' /* &nbsp; */ }*</span> ) }
					</span></label>

					{ shouldShowHelpText &amp;&amp; (
						<span style="{">
							{ '\u00A0' /* &nbsp; */ }
							
						</span>
					) }
				</div>
			) }</div>
github beaverbuilder / assistant / src / front / ui / components / content-list / update-list / detail.js View on Github external
<title>{__( 'Update' )}</title>

			{ banner &amp;&amp;  }

			
				
					
						{ updating &amp;&amp;  }
						{ updatingText }
					
				
			

			
				{ __( 'Description' ) }
				
			

		
	)
}
github beaverbuilder / assistant / src / original-ui / ui / components / content-list / update-list / detail.js View on Github external
{ banner &amp;&amp;  }

			
				
					
						{ updating &amp;&amp;  }
						{ updatingText }
					
				
			

			
				{ __( 'Description' ) }
				
			

		
	)
}
github beaverbuilder / assistant / src / _original / original-ui / ui / components / content-list / comment-list / detail.js View on Github external
}

					{ editing &amp;&amp;
						 setEditing( false ) }
						/&gt;
					}

					{ ! editing &amp;&amp;
						<div style="{{">
							
								{contentTitle}
								<div>
							
						</div>
					}
				

			
		
	)
}
</div>
github beaverbuilder / assistant / src / front / ui / components / content-list / comment-list / detail.js View on Github external
}

					{ editing &amp;&amp;
						 setEditing( false ) }
						/&gt;
					}

					{ ! editing &amp;&amp;
						<div style="{{">
							
								{contentTitle}
								<div>
							
						</div>
					}
				

			
		
	)
}
</div>
github pods-framework / pods / ui / js / blocks / src / blocks / components / BlockPreview.js View on Github external
);
		}
		case 'TextareaControl': {
			const {
				auto_p: shouldAutoP,
			} = fieldOptions;

			const sanitizedText = sanitizeHtml( fieldValue, plainText );

			return (
				<div name="">
			);
		}
		case 'RichText': {
			return (
				
			);
		}
		case 'CheckboxControl': {
			return (</div>

@wordpress/autop

WordPress's automatic paragraph functions `autop` and `removep`.

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

Package Health Score

95 / 100
Full package analysis

Popular @wordpress/autop functions