Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import/export of posts in Markdown format #196

Open
vadimkantorov opened this issue Oct 10, 2024 · 2 comments
Open

Import/export of posts in Markdown format #196

vadimkantorov opened this issue Oct 10, 2024 · 2 comments

Comments

@vadimkantorov
Copy link

vadimkantorov commented Oct 10, 2024

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.

@swissspidy
Copy link
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.

@vadimkantorov
Copy link
Author

vadimkantorov commented Oct 14, 2024

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.

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

No branches or pull requests

2 participants