0.2.0 • Published 5 years ago

medium-markdown v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Medium Markdown

npm V0.1.0 GitHub

Introduction

This package provides two functions:

  • generating markdown from an Medium article
  • writing the article to file

The package supports Jekyll style blogging, such that you can directly copy the generated file into your _posts/ folder.

Usage

const markdownConverter = require('medium-markdown');

async function main(postUrl) {
    markdownConverter.generateFile(
        await markdownConverter.convert(postUrl));
}

The convert function returns a dict containing { markdown, heading, time } for the Medium post.

generateFile also takes in an optional padding before and after argument, which it adds to the markdown. Thus, to directly generate Jekyll suitable markdown posts, you can do the following (this is the script I use too):

const markdownConverter = require('medium-markdown');

const url = 'your medium article url';

const paddingBefore = `---
layout: post
---
Originally published on [Medium](${url})  
`;

async function main(postUrl) {
    markdownConverter.generateFile(
        await markdownConverter.convert(postUrl),
        paddingBefore,
    );
}

main(url);

Further, I have fixed the subtitles for images looking pathetic. To style the subtitles however you want, you can use the following css. Or add it to your existing .scss file on Jekyll.

img + em {
    font-style: italic;
    font-weight: 600;
    margin-bottom: 20px;
    margin-top: 8px;
    display: block;
    text-align: center;
    font-size: 14px;
    color: black;
}

This returns me, precisely, this

0.2.0

5 years ago

0.1.4

5 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago