DEV Community

Cover image for Convert: Medium Markdown Dev.to
An Rodriguez
An Rodriguez

Posted on

Convert: Medium Markdown Dev.to

Recently, I've been writing in Dev.to and Medium.

I have found it's a hassle to keep both sites in sync. Sometimes I tweak here or there.

One of the things I like a lot about Dev.to is that you write in straight markdown. When you edit an article you edit directly the Markdown.

As a huge plus, you can install tools like Grammarly that help you identify typos or other grammar mistakes. Grammarly also comes with a handy browser add-on you can install and it will check your article as you type in Dev.to.

This is not true for Medium. Not true about writing in plain Markdown and not true for Grammarly either.

That is why I like to write primarily in Dev.to and later import articles into Medium.

Medium to Markdown

Though it can feel markdown-ish, Medium does not give an option way to obtain the markdown of your article back.

If you're not afraid of the CLI there is, however, a very interesting npm tool I've just learned about: mediumexporter.

It's very easy to use (Thanks @macropus for such an useful post!):

  1. If you yet don't have npm, install it.
  2. After installing npm, run npm install -g mediumexporter
  3. Finally, download your article with mediumexporter https://medium.com/medium-url > your_article.md

After executing that last command, you'll find your Medium article in the current directory under the name your_article.md.

Markdown to Medium

Sometimes you have a nice markdown document you want to import to Medium. Fortunately, you can import your Dev.to story to Medium going to Stories->Import Story.

However, there is also another very nice tool called markdowntomedium.com that takes care of your beautiful code snippets and automatically posts them to Github.

How does it work?

This tool takes the pain out of importing a Markdown post into Medium by doing the manual labor for you (creating a gist on Github of your markdown). It also scans your Markdown file for any code blocks and extracts them into their own gists so Medium can syntax highlight them.

Automatically updating a Medium story with a revised markdown

I haven't figured out how to automatically update a Medium article from a revised markdown.

AFAIK, Medium does not have a way to reimport a story. If it were possible, then the "Markdown to Medium" method would work.

So, for now, I just export the Medium story to markdown and compare it with the revised markdown article. I then modify the Medium article change by change, one by one. It's a hassle, but it is what it is.

Do you have a better method? If so, I'd like to know about it.

Top comments (3)

Collapse
 
eekayonline profile image
Edwin Klesman

I found out about the mediumexporter cli recently myself. Works nicely.

Updating changes into Medium content keeps being a hassle. Only fix I have is better checking my article before publishing 😅.

Keep up the writing!

Collapse
 
feldev profile image
Félix Paradis

I found another solution which is better if you want to process ALL your Medium posts.
npmjs.com/package/medium-2-md

Collapse
 
pftg profile image
Paul Keen

We use github.com/miry/medup and looks good enough