gautamdhameja / medium-2-md

A CLI tool that converts exported Medium posts (html) to Jekyll/Hugo compatible markdown with front matter.
https://www.npmjs.com/package/medium-2-md
Apache License 2.0
142 stars 19 forks source link

Header image option #11

Closed pellicceama closed 4 years ago

pellicceama commented 4 years ago

A number of Hugo themes rely on an image variable to be set on the frontMatter in order to designate an image as a header image for a particular post.

This PR adds a --headerImage (or -h) option to medium-2-md.

Basically, it seems like the html-to-markdown library that this utility uses extracts the medium header images into an image markdown tag at the beginning of the body of the post.

If the --headerImage flag is set, this takes it from the body and adds it to the frontMatter as an [image]: /img/imagefile.jpg.

pellicceama commented 4 years ago

@gautamdhameja thanks for creating this! Hopefully, this is a useful addition. 🙂

gautamdhameja commented 4 years ago

Thanks @pellicceama, but did you test if this is working? For me, it does not seem to work for convertLocal. Also, the image variable in front matter is not a default/predefined for both hugo and jekyll. I don't think we should add this.