@automattic/rtjson-to-wpblocks
Version:
Javascript code to convert Day One RTJson to WordPress Gutenberg Blocks
69 lines (57 loc) • 1.89 kB
text/xml
<!-- wp:heading {"level":1} -->
<h1 class="wp-block-heading">Here is an example RTJSON entry</h1>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>It has a paragraph</p>
<!-- /wp:paragraph -->
<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>And a list<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>Indented<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>again</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list --></li>
<!-- /wp:list-item --></ul>
<!-- /wp:list --></li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->
<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>Number list<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>Sublist</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list --></li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->
<!-- wp:paragraph -->
<p>And even a photo:</p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":11,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large"><img src="https://testposting.mystagingwebsite.com/wp-content/uploads/2024/06/IMG_7738-768x1024.jpeg" alt="" class="wp-image-11"/></figure>
<!-- /wp:image -->
<!-- wp:code -->
<pre class="wp-block-code"><code>Here is a code block</code></pre>
<!-- /wp:code -->
<!-- wp:quote -->
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
<p>Here is a quote block</p>
<!-- /wp:paragraph --></blockquote>
<!-- /wp:quote -->
<!-- wp:paragraph -->
<p>Here is a paragraph <strong>with bold text</strong> and <em>with italicized text</em> and <strong><em>with both</em></strong>.</p>
<!-- /wp:paragraph -->
<!-- wp:heading -->
<h2 class="wp-block-heading">Header 2</h2>
<!-- /wp:heading -->
<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Header 3</h3>
<!-- /wp:heading -->
<!-- wp:separator -->
<hr class="wp-block-separator has-alpha-channel-opacity"/>
<!-- /wp:separator -->
<!-- wp:paragraph -->
<p>That was a separator</p>
<!-- /wp:paragraph -->