I think I'm really close to getting images to fit into the blocks scheme in Gutenberg.
Here's what I do
In WordLand, the user uploads an image.
That generates an HTML img element, which the user then pastes into their WordLand document.
When the user clicks the airplane icon to publish, it is sent to the wpidentity server in Markdown.
Before converting the Markdown to HTML in order to send it to WordPress, it preprocesses the text, converting the Markdown images to Gutenberg images. I got this text by creating a post using the block editor in WordPress, then replicating what it generated for the image. I will paste in an example in source in the section below.
Then it converts it the Markdown text to HTML and makes the call to wordpress.com via the wpcom API.
The code that's generated by preprocessor
"<p>Now I'm interested to see how WordPress represents image blocks in Gutenberg.</p>
<!-- wp:image -->
<figure class="wp-block-image size-large is-resized"><a href="https://daveverse.wordpress.com/wp-content/uploads/2024/11/mrsmith.png"><img src="https://daveverse.wordpress.com/wp-content/uploads/2024/11/mrsmith.png" alt="" class="wp-image-4375" style="width:86px;height:auto"/></a></figure>
<!-- /wp:image -->
<p>Some text after the image.</p>
"
We also made some changes to the WordPress.com implementation to improve the detection of non-block images... We plan to release these changes next week!
I think I'm really close to getting images to fit into the blocks scheme in Gutenberg.
Here's what I do
The code that's generated by preprocessor
The results
The page on wordpress.com.
The post on mastodon.
As you can see the image does not get through to Mastodon, but I feel like we're really close?
attn @pfefferle