Converts medium posts (html) into Jekyll/Hugo compatible markdown files. Also extracts and adds yaml front matter to the converted markdown files. This package works with already exported Medium posts and also with post urls. It converts all exported posts to markdown using a single command. It is mainly useful in scenarios when you want to migrate your blog away from Medium to Jekyll or Hugo (or something similar which supports markdown content).
Steps to use
Convert local Medium exports
- Export and extract your Medium posts from your Medium account.
- Go to
https://medium.com/me/settingsand scroll to
Download your information. Click the download button. This will give you a
medium-export.ziparchive containing all your Medium content.
- Extract the .zip archive downloaded in the previous step. It will have a sub-directory called
- Copy the path of this
- Go to
medium-2-mdon your system.
- Download and Install node.js - https://nodejs.org/en/download/.
- Install medium-2-md -
npm i -g medium-2-md.
- Run the following command to convert all your Medium posts (html) to markdown files,
medium-2-md convertLocal '<path of the posts directory>' -df
That's it. The output markdown files will be stored in a sub-directory called
The converted markdown files will have front matter which will have title, description, published date and canonical URL of the original Medium post/story.
Convert from post URL
The CLI tool can also be used to convert a single Medium post from it's url. It requires an additional parameter
-o for output directory where the converted markdown file can be written. To convert a Medium post to markdown from it's url, run the following command after installing the npm package,
medium-2-md convertUrl '<url of the Medium post>' -o '<path of output directory>' -f
convertLocal command supports the following optional flags,
--draftswhich means if you want to convert the drafts too.
--frontMatterwhich means if you want to add the front matter on top of the markdown file.
-f flag is supported by the
convertUrl command also.
Example: Convert from local - drafts enabled
medium-2-md convertLocal E:\\path\\to\\posts\\dir -d
Example: Convert from local - front matter enabled
medium-2-md convertLocal E:\\path\\to\\posts\\dir -f
Example: Convert from url - front matter enabled
medium-2-md convertUrl -o E:\\path\\to\\output\\dir -f
Note: The flags do not support any defaults. You need to add them in order to get the respective results (drafts and/or front matter inclusion).
This package uses: