DEV Community

Cover image for Cross-Post CLI Tool: New Features and Fixes
Shahed Nasser
Shahed Nasser

Posted on • Originally published at blog.shahednasser.com

Cross-Post CLI Tool: New Features and Fixes

Almost a year ago, I wrote about how I created a CLI tool to cross-post articles to Dev.to, Hashnode, and Medium. I created the tool because it made the process easier for me, but I also received a lot of feedback from other writers about how it was helpful for them.

Since then, I haven't been able to maintain it much due to my busy schedule. Now, I'm taking more time to commit to it and improve it with the help of the community.

On Monday, the 28th of February, I pushed out a new release of cross-post-blog with the version 1.3.0. I'll be sharing some of the features and fixes it includes. You can also check out the GitHub repository for more information about the library.

If you're reading this article on Dev.to, Hashnode, or Medium, then it is reposted from my own blog using the Cross-Post CLI tool!

Posting From Local Files

Based on demand from some of the developers using this library, I've now added the ability to post directly from a local file instead of a public URL. To do that, you simply need to add the -l or --local option to your command.

For example:

cross-post run /path/to/test.md -l
Enter fullscreen mode Exit fullscreen mode

This will post a local file test.md to all of the platforms.

You can also use it with all of the options you previously used.

Changed Markdown Converter

Each of the platforms requires you to send the content of your article to post in Markdown format. So, when you pass a URL to the command, the content of the article on that page is converted to Markdown before submitting it to the platform you want to post on.

I previously was using node-html-markdown. It worked fine in terms of functionality. However, there were some issues related to how it parsed code blocks.

The new version is now using turndown instead, which does a better job of parsing code blocks. Your articles should now be posted to the different platforms almost exactly as you have it posted on your own blog.

Added Title Selector

Previously, you could set a default article and image selectors in the configuration. You could also override those configurations in the run command.

N0w, you can also set the default title selector in your configuration:

cross-post config titleConfig
Enter fullscreen mode Exit fullscreen mode

Or, pass it as an option -ts or --title-selector to the run command:

cross-post run <url> -ts .post-full-title
Enter fullscreen mode Exit fullscreen mode

Upcoming Features

I'll be working from now on to improve the tool and add new features, either from the request of developers using this tool or from my own experience using it. For example, a feature that has been requested is the ability to update posts.

I'm also going to look into adding new platforms to enable posting to. If you have any platform in mind that you think would be good to add please do let me know!

How to Install or Update

If you want to install and start using Cross-Post or update your version you can install it with NPM:

npm i -g cross-post-blog
Enter fullscreen mode Exit fullscreen mode

Please check the README for more information on installing and using this tool.

Contribution

At the moment, there's no contribution guideline added in the repository (I'm working on that). However, if you would like to contribute to any of the existing issues or add new features, then please don't hesitate!

Top comments (0)