Test post with my WP-Editor — Part 1

This is a test post with my md2xml plugin

I am writing a simple Python application, which can convert text written in a specific dialect of mark-down text to a WordPress post.

I do this to have one open-source offline application which helps me to write articles on my commuting to work — in a way I know from LeanPub.

And this is the first part of the application…


Good question but as a software developer I like to write code. And I like to share my knowledge too but at work and at home I am too busy to create articles. But I am commuting every day around one hour to work (and back of course) by train and there I have plenty of time to create articles.

But only offline because the internet connection is bad.

My goals for the project

I stated my goals to create this simple offline application to enable text written in a specific mark-down format and then upload it to my WordPress.com blog (so this one) through the REST API.

And if I succeed this will be an open-source project written in Python which can be used by anyone. If I will go further, there is an option to create a WYSIWYG editor to enable formatted editing ang convert the result into mark-down to trigger this part of the application, but it is OK if the editor generates XML because that way the conversion part can be skipped.

But with my approach there are some problems.


This is my first problem which I encountered during development. The REST API uses OAuth to secure the communication between the client and the server.

This won’t be a big problem but for this you have to enable access to your blog for the requesting application. Because all this goes in the command-line, there is no really way to enable this access.

Well, to be honest, I have an “evil” idea in my mind but this would be a bit un-cool for the user. And I am not sure if it would work.

And I have a second idea too which is half the way evil but again, I am not sure if it could work.

The second problem is, after you manage to enable access to your blog, the application has to send its secret key to the authentication server to request a communication token. And this is a bigger problem I think.

That’s because the open-source behavior of the application every one could access this secret key. I know you think about “How about encrypt the secret key and only decrypt it at runtime?” This is a no-go because you could easily trigger the decryption and could access my key. Bad thing.

Solution for me

The REST API enables a password-authentication feature for the creator of the application. So the overloaded work with authenticating the application and sending the secret key is obsolete.

But this works only for me.

A broader solution for this problem would be that every one using my application creates a WordPress application for himself/herself and uses that application ID with his/her username and password to manage their blogs.

Sounds not bad, does it?

Solution for others

However there is another solution for this problem but it is based on the old XML-RPC protocol used by other offline editing tools like Quamana or MarsEdit.

I do not like the idea of using this protocol because it is old and we live in a REST enabled world where the modern APIs communicate through REST objects.

Although I do not like the idea of using this API I have to do it. Fortunately there is a Python library out there written by Max Cutler which enables the communication with a WordPess blog so I will include it as a project dependency until I find a better solution.

Current state

Currently the mark-down to XML part for content is ready. I am working on the connection between the application and WordPress. I do not have a fix deadline to get it work but I want to finish that part by end of February.

How do you post now without connection to WP?

Good question. Currently it is a bit bothersome because I have to write the content into the mark-down file, then let the mdxml.py application run through it and it results in a XML file.

The contents of the file I have to copy and paste it into WordPress in the source code editor of the article. I have to add the title, tags, category and such configurations manually.

Next steps

As I stated above, my next goal is to finish the communication between WordPress and my application. First with XML-RPC and if I find a solution then with REST.

After that I’m going to extend the configuration to enable the title of the article to be set in the mark-down file.

After the title works, I plan to add tags, categories, schedule time and other configuration options you can set through the API for your posts.

For the categories I’ll add a validation if it is needed so that WP does not returns the post with an “unknown category” error or something like that.

And after the one way communication works, I’ll see how to add post-management to this application. Post management would mean edit and delete posts

The last big part would be images and other media. However I do not really need this feature but for an open-source software it would be not bad because some people share pictures and videos on their blogs.


Because the application is open-source, you can find it at my GitHub account with a brief description how to use it.

If you find any bugs or possible enhancements just write me a mail or issue a ticket at the GitHub repository.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s