Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


A CLI tool that converts medium posts (html) into Jekyll/Hugo compatible markdown files. Also downloads images and adds yaml front matter to the converted markdown files. It works with exported Medium posts (local html files) and converts them to markdown using a single command. It can be useful in scenarios when you want to migrate your blog away from Medium to Jekyll or Hugo (or something similar that supports markdown content).

Steps to use

Convert local Medium exports

  1. Export and extract your Medium posts from your Medium account.
    1. Go to and scroll to Download your information. Click the download button. This will give you a archive containing all your Medium content.
    2. Extract the .zip archive downloaded in the previous step. It will have a sub-directory called posts.
    3. Copy the path of this posts directory.
  2. Install node.js and medium-2-md on your system.
    1. Download and Install node.js -
    2. Install medium-2-md - npm i -g medium-2-md.
  3. Run the following command to convert all your Medium posts (html) to markdown files,
medium-2-md convertLocal '<path of the posts directory>' -dfi

That's it. The output markdown files will be stored in a sub-directory called md_<a big number> in the input posts directory itself. (By the way, that big number is coming from the JavaScript function, added to differentiate multiple output folders.)

The converted markdown files include front matter containing title, description, published date and canonical URL of the original Medium post/story. The images from the Medium posts are downloaded in a sub-directory called img inside the output directory.

Optional flags

The convertLocal command supports the following optional flags,

  1. -d or --drafts: Convert the drafts too.
  2. -f or --frontMatter: Add the front matter on top of the markdown file.
  3. -i or --images: Download images to a local img sub-directory.

Example: Convert from local - drafts enabled

medium-2-md convertLocal E:\\path\\to\\posts\\dir -d

Example: Convert from local - images enabled

medium-2-md convertLocal E:\\path\\to\\posts\\dir -i

Note: The flags do not support any defaults. You need to add them in order to get the respective results (drafts, images and/or front matter inclusion).

Image Download

When using the -i or --images flag, the images are downloaded into a sub-directory called img inside the output directory. If this img directory does not already exist, it is created. If it already exists, the downloaded images are saved inside the existing directory. The image elements in the converted markdown files link to their respective local paths from the img sub-directory.


This package uses:

  1. turndown - to convert html into markdown.
  2. cheerio - to select and extract relevant html attributes from Medium posts' html files.
  3. commander - to enable command line interface.
  4. js-yaml - to add yaml front matter to markdown files.
  5. node-fetch - to download images.


A CLI tool that converts exported Medium posts (html) to Jekyll/Hugo compatible markdown with front matter.





No packages published