github / mentorships

GitHub Open Source Mentorships (deprecated)
335 stars 57 forks source link

Jekyll plugin to automatically generate Pdf, Epub and Mobi versions of posts #116

Closed ghost closed 7 years ago

ghost commented 8 years ago

Jekyll plugin similar to the Read Offline Wordpress Plugin that generate versions of posts for e-readers and offline use, and make them easily downloadable through the website without any further interaction from the writer.

parkr commented 8 years ago

Hey @davgit2 –

This is a great idea for GSoC. I know of many Jekyll users who would love to use Jekyll to write long-form essays and books with greater support for portability to various devices. We would be happy to mentor you for this project if you applied. I can foresee certain challenges in customization of this plugin (e.g. styling the PDF, choosing which formats to allow, etc), as well as some challenges in encoding with various languages, but those could be solved over time. Would you like to sketch out how you think it could work, how you think you'd go about approaching this work, and potential challenges you see?

Thanks! Looking forward to possibly working with you. :smile:

ghost commented 8 years ago

Glad you like the idea 😃. Sorry for the delay, I have done some additional research. Kramdown supports Markdown to PDF conversion via Prawn since version 1.3.0, but I didn't find any good Markdown to Epub converter, neither using Kramdown, nor written in Ruby, so maybe a Pandoc Ruby wrapper could be a good starting point. The Epub could then be passed to Kindlegen in order to generate a Mobipocket version and these documents could be stored in a _site/format_name directory and be linked by adding an Html div at the end of the post, with a reference (button) for each format. For instance:href="_site/epub/{{post-title}}.epub". The user might also customize the plugin to choose wether he wants to place the links at the bottom or at the top of the posts, which format(s) to use, colors, etc...

Does it sound good to you ?

A challenge I see would be to tightly integrate the build process so it wouldn't require extra steps and would be transparent for the user. An other possible challenge would be to use tools which haven't been intended to be automated for a plugin (e.g. the Kindlegen CLI).

Edit 03/04/16: I think Pandoc would be a better option instead of Prawn, after I read on their webpage that it may not be the right tool for markup languages :

We do have basic support for inline styling but it is limited to a very small subset of functionality and is not suitable for rendering rich HTML documents. One thing Prawn is not, and will never be, is an HTML to PDF generator.

I have done some test to stylize a PDF with Pandoc using the Xelatex Latex engine, smaller margin (compared to the default Latex output), Helvetica Neue as the main font and a font size of 12pt. I have linked the result with a Wikipedia article.

Wallcreeper.pdf Wallcreeper.md.txt

ghost commented 8 years ago

Hello It's me again, due to an unfortunate problem I had to delete my Github account. Since I cannot edit anymore my old posts I let you know here that my account has changed (but my username is still the same).

greenbigfrog commented 8 years ago

This is exactly what I'm looking for. Any update?

parkr commented 8 years ago

@greenbigfrog This was not selected for this year's GSoC and to the best of my knowledge is not under active development. There may be a third-party plugin available, but I don't know of one.