Skip to content

Export/import of posts in Markdown format #196

Closed as not planned
Closed as not planned

Description

@vadimkantorov

Of course, markdown is much more restricted than general block markup, but for many blogs having some basic support would be very nice (especially for CLI-oriented people starting to play with WordPress with existing Markdown files), as there are plenty of various Markdown editors, and many simple blogs are written in the Markdown format (with some html tags sprinkled). It is okay if this support is not perfect as not every block can be faitfully and completely represented by some markdown/with minimal html tags/styles

WordPress has a ton of many different Markdown plugins, but having some basic variant (relying on some existing established php Markdown library) in the wp-cli (and thus having a smaller scope) would simplify simple blogs workflow and interop of WordPress with other blog engines.

This would be very helpful for usage of WordPress as static site generator.

Activity

  1. swissspidy commented on Oct 10, 2024

    @swissspidy
    Member

    This sounds like a good use case for a community-maintained package. https://github.com/gloomic/wp-cli-markdown-post seems to be doing parts of what you're looking for, maybe that can serve as a foundation.

  2. vadimkantorov commented on Oct 14, 2024

    @vadimkantorov
    Author

    Yeah, I found that in WP ecosystem there're many-many various markdown plugins taking various approaches wrt rendering and editing (either render markdown2html at post adding time or keep the original markdown).

    My usecase is: importing markdown posts to be able to use WP as a static-site-generator (meaning that I don't have a maintained WP instance, I'm reinitializing the database from scratch at every site build. I'm keeping wp_options as a JSON file and all posts as files in a github repo and I'm importing them at site build). So for this usecase rendering the posts to html at import time is totally okay, and what's important is keeping compat with Jekyll post filename format and the Jekyll frontmatter fields (like title, authors, tags). I currently somewhat managed to do this using https://github.com/dirtsimple/postmark, but it doesn't support very well Jekyll's frontmatter...

    https://github.com/gloomic/wp-cli-markdown-post seems also possible, but its installation seems to require modification of theme files.

    I realize that maybe this usecase is not the main usecase for WP, but maybe having some very basic support for Markdown in core WP/wp-cli would be nice. I am of course not blocked, just it's a bit hard to figure out which plugins to use. So if this usecase of using WP as static-site-generator is considered important (thus needed kind of tested wp-cli commands to import options, add posts from markdown files and static rendering of the whole site), maybe some recipe / instruction of using some plugins to achieve this would be very helpful. But I also understand why you might not actually want that.

  3. vadimkantorov commented on May 2, 2026

    @vadimkantorov
    Author

    @swissspidy Btw given the LLMs like Markdown format, it can be very useful to have a good built-in WordPress support of rendering a post as good-formatted markdown (e.g. by adding a .md extension to the URL), and also would be very useful to have it as wp-cli command for the same purpose (to store the content of the whole website in a directory with Markdowns which can be consumed by a local edge LLM)

  4. changed the title [-]Import/export of posts in Markdown format[/-] [+]Export/import of posts in Markdown format[/+] on May 2, 2026
  5. swissspidy commented on May 2, 2026

    @swissspidy
    Member

    Let's continue the discussion at wp-cli/block-command#11

    For URL conversion I recommend using the plugin I shared there, https://github.com/dmsnell/html-to-md.

    Converting individual blocks and posts to Markdown may be interesting for WP-CLI core, but a full website archive/export is really best suited in a community package.

  6. vadimkantorov commented on May 2, 2026

    @vadimkantorov
    Author

    a full website archive/export is really best suited in a community package.

    I understand your point and agree in general, but I think that specifically the appetite of LLMs for Markdown (and llms.txt and llms-full.txt formats) might be worthy to motivate inclusion of markdown export in core wordpress and wp-cli...

  7. vadimkantorov commented on Sep 24, 2026

    @vadimkantorov
    Author

    It appears that native Markdown import/export is pusued in https://github.com/Automattic/markdown-database-integration

    It would be great to use this package (or its approach) for wp-cli command working with markdown import/export - to not have to install MDI separately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions