Cross-Post CLI Tool: New Features and Fixes
Tags: javascript, showdev, opensource, productivity
Published: 2022-02-28 15:20:13

Almost a year ago, I wrote about how [I created a CLI tool](https://blog.shahednasser.com/i-created-a-cli-to-cross-post-your-articles-on-dev-hashnode-and-medium) to [cross-post](https://github.com/shahednasser/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](https://github.com/shahednasser/cross-post) 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](https://blog.shahednasser.com/cross-post-cli-tool-new-features-and-fixes/) 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

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](https://github.com/shahednasser/cross-post#cross-posting-your-articles).

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`](https://www.npmjs.com/package/node-html-markdown). It worked fine in terms of functionality. However, there were some issues related to how it [parsed code blocks](https://github.com/shahednasser/cross-post/issues/14).

The new version is now using [`turndown`](https://www.npmjs.com/package/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

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

    cross-post run <url> -ts .post-full-title

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](https://github.com/shahednasser/cross-post/issues/20).

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

Please check the [README](https://github.com/shahednasser/cross-post) 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](https://github.com/shahednasser/cross-post/issues) or add new features, then please don't hesitate!