-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Description
The convert command for WP-CLI changes data from one type to another.
Sample use case: Markdown to Block Markup
The idea is to be able to consume a Markdown file and turn it into a HTML file, which could then be copy/pasted or otherwise imported via the CLI into the Block Editor.
Given the following best-chicken-wings-in-scotland.md file
## Scotland's Best Chicken Wings
Found in Edinburgh, you have to visit the Wingstop at Edinburgh Fountain Stop.
These are the best wings you will find around!
Converts to
<!-- wp:heading -->
<h2 class="wp-block-heading">Scotland's Best Chicken Wings</h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>Found in Edinburgh, you have to visit the Wingstop at Edinburgh Fountain Stop.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>These are the best wings you will find around!</p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":7,"sizeSlug":"full","linkDestination":"none"} -->
<figure class="wp-block-image size-full"><img src="http://development.local/wp-content/uploads/2024/06/chicken-wing.jpg" alt="An image of a crispy chicken wing being dunked into ranch dressing" class="wp-image-7"/></figure>
<!-- /wp:image -->Syntax
wp post convert best-chicken-wings-in-scotland.md
Success: Converted to HTML.
Flags
--create β Create the post as a draft in this WordPress instance.
--copy β Copy HTML to the clipboard.
--no-follow β Add no-follow to any image tags (good for adverts)
Behind the scenes
Uploads any images found into the Media Gallery