Skip to content

Instantly share code, notes, and snippets.

View mrwpress's full-sized avatar

Mr. WPress mrwpress

View GitHub Profile
@mrwpress
mrwpress / wpautop.js
Last active November 12, 2021 19:20 — forked from ediamin/wpautop.js
JavaScript version of WordPress wpautop function
// source: https://github.com/andymantell/node-wpautop
function _autop_newline_preservation_helper( matches ) {
return matches[ 0 ].replace( "\n", "<WPPreserveNewline />" );
}
function wpautop( pee, br ) {
if ( typeof (br) === 'undefined' ) {
br = true;
}