Working with WordPress Blocks

WordPress 5.0, released in 2018, introduced a new concept to the web-based WordPress editor called “blocks”. Blocks are independently editable sections of a post that represent various types of content. Each block represents a section of text, an image, etc. and can be created and manipulated by dragging them around in the post.

MarsEdit emphasizes a more streamlined design for writing posts, so that in the process of writing, you can focus more on the content than on the layout and organization of the piece. We think that this workflow is more suitable to most blogging needs, while the block-based approach in WordPress is more suitable to general web development.

If you choose to use MarsEdit in conjunction with a blog or web site that uses WordPress blocks, here are some tips for making things work smoothly.

At their core, blocks are implemented by using HTML comment elements to denote their separation from other parts of a post. For example, the underlying HTML for a WordPress paragraph block might look like this:

<!-- wp:paragraph -->
<p>This is one block.</p>
<!-- /wp:paragraph -->

Because MarsEdit works with HTML content, you can edit and manipulate the content of blocks-based posts without adversely affecting the published blog, as long as you preserve the expected block formatting as demonstrated above. If you wish to do this, it’s probably best to stick to MarsEdit’s “Plain Text” editor when making changes, so you can see all the pertinent HTML markup, and make sure it’s preserved.

When adding new paragraphs, you could manually add the “<!– wp:paragraph –>” and “<!– /wp:paragraph –>” lines before and after each paragraph to make them WordPress blocks, but this would get pretty tedious. To make it easier, consider creating a custom “Formatting Macro” by selecting Format -> Customize… from the menu bar while editing a post. Custom macros give you the ability to apply formatting changes like the above to selected content in either the rich or plain text editor. Unfortunately these blocks won’t show any differently in MarsEdit than a regular paragraph, but the special markup will inform WordPress of their intended use as a block.