All Projects → gautamdhameja → medium-2-md

gautamdhameja / medium-2-md

Licence: Apache-2.0 License
A CLI tool that converts exported Medium posts (html) to Jekyll/Hugo compatible markdown with front matter.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to medium-2-md

awesome-static-digital-libraries
Delightful Static Digital Library projects and resources
Stars: ✭ 23 (-79.65%)
Mutual labels:  jekyll, hugo
Awesome Docs With Static Site Generators
Pointers to all templates and implementations based on static site generators
Stars: ✭ 44 (-61.06%)
Mutual labels:  jekyll, hugo
Medium To Hugo
Medium stories exporter to markdown/hugo articles.
Stars: ✭ 64 (-43.36%)
Mutual labels:  medium, hugo
Notfoundbot
fix & archive outgoing links on your website
Stars: ✭ 74 (-34.51%)
Mutual labels:  jekyll, hugo
Awesome Static Hosting And Cms
A collection of awesome static hosting & CMS providers
Stars: ✭ 163 (+44.25%)
Mutual labels:  jekyll, hugo
Vanilla Back To Top
Simple and smooth Back To Top button
Stars: ✭ 179 (+58.41%)
Mutual labels:  jekyll, hugo
Jamstackthemes
A list of themes and starters for JAMstack sites.
Stars: ✭ 298 (+163.72%)
Mutual labels:  jekyll, hugo
Create Static Site
Create static websites with no build configuration.
Stars: ✭ 124 (+9.73%)
Mutual labels:  jekyll, hugo
Pendulum
A simple markdown editor for static files (Hugo, Nexo, Jekyll, MkDocs, ...)
Stars: ✭ 157 (+38.94%)
Mutual labels:  jekyll, hugo
Staticman
💪 User-generated content for Git-powered websites
Stars: ✭ 2,098 (+1756.64%)
Mutual labels:  jekyll, hugo
Post Scheduler
Schedule posts & content updates for static websites (Jekyll, Hugo, Gatsby, Phenomic etc)
Stars: ✭ 184 (+62.83%)
Mutual labels:  jekyll, hugo
jefftriplett.github.io
📝 My blog which is held together by duct tape and bailer twine
Stars: ✭ 14 (-87.61%)
Mutual labels:  jekyll
vue-jekyll
This Repo is a bare-bones template for building static sites that leverage a client-side JS framework for dynamic functionality.
Stars: ✭ 84 (-25.66%)
Mutual labels:  jekyll
hugo-theme-lean-launch-page
A theme for people creating pre-launch pages for a product or business. Allows you to have a landing page while collecting emails.
Stars: ✭ 26 (-76.99%)
Mutual labels:  hugo
hugo-atom-feed
Hugo theme component for ATOM feed custom Output Format
Stars: ✭ 29 (-74.34%)
Mutual labels:  hugo
export-to-markdown
A Chrome extension to export the story in Medium to a markdown format text.
Stars: ✭ 62 (-45.13%)
Mutual labels:  medium
event-jekyll-theme
Jekyll Theme package for your event
Stars: ✭ 119 (+5.31%)
Mutual labels:  jekyll
business-jekyll-theme
Business Jekyll Theme for your business
Stars: ✭ 43 (-61.95%)
Mutual labels:  jekyll
jekyll-stickyposts
Jekyll Stickyposts - move selected posts to the top of the list
Stars: ✭ 23 (-79.65%)
Mutual labels:  jekyll
website
The next-gen website of LUG@USTC.
Stars: ✭ 15 (-86.73%)
Mutual labels:  jekyll

medium-2-md

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 https://medium.com/me/settings and scroll to Download your information. Click the download button. This will give you a medium-export.zip 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 - https://nodejs.org/en/download/.
    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 Date.now() 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. -f or --frontMatter: Add the front matter on top of the markdown files.
  2. -i or --images: Download images to a local img sub-directory.
  3. -op or --path: Custom path for saving markdown files.
  4. -ip or --img-path: Custom path for downloading images.
  5. -d or --drafts: Convert the drafts too.

Example: Convert from local - front matter and images but no drafts

medium-2-md convertLocal '/home/user/Desktop/posts' -fi

Example: Convert from local - default output and images path

medium-2-md convertLocal '/home/user/Desktop/posts' -dfi

Example: Convert from local - with custom output and images path

medium-2-md convertLocal '/home/user/Desktop/posts' -dfi --path '/home/user/Desktop/md' --img-path '/home/user/Downloads/img'

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).

Custom Output and Image Paths

When using the -op or the --path flag, the output markdown files are written to this path instead of the default value. If this custom path is invalid or does not exist, the output files are written to the default path.

When using the -i or --images with the --img-path flag, the images are downloaded into the directory at this custom path. If this directory does not already exist, the images are downloaded to the default path. The image elements in the converted markdown files link to their respective local paths.

Dependencies

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].