Rails gem to generate eBooks using the Markdown syntax to format content for sections of the book.
An example of this gem being used can be found at: dskri.be
Requires:
- Rails 4
- Rubyzip (to generate the .epub)
- Redcarpet (to render Markdown into HTML)
- Kindlegen (to generate .mobi files)
Add this line to your application's Gemfile:
gem 'ebook_generator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ebook_generator
Generate the tables needed to process the ebooks:
rails generate ebook_generator
Migrate the database:
rake db:migrate
Pass the ebook object you want to generate:
EbookGenerator.generate_ebook(ebook_object)
This will then generate an ePub based on the values in the db and output to the /tmp folder.
For a Kindle mobi file then pass in kindle
as the second argument:
EbookGenerator.generate_ebook(ebook_object, 'kindle')
To enable the generation of Kindle mobi files then you will first need to download the kindlegen
command line tool from Amazon and put it in your apps /bin
directory.
- Style editing
- PDF out
- HTML out
- Image support for the front cover
- HTML to eBook conversion
- Fork it ( https://github.com/[my-github-username]/ebook_generator/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request