Site icon Hip-Hop Website Design and Development

Is there a function to "blockify" html?

Let’s say we have a string that contains

<h1>Here's a title</h1>
<p>Here's some text</p>

I’m looking for a function that parses this to whatever a block looks like (written from memory).

<!-- wp-paragraph -->
<p class="wp-block-paragraph">Here's some text</p>
<!-- /wp:paragraph -->