From markdown files to PDF book:
- Clickable table of contents
- Page markers
- Code blocks with syntax highlighting
- Support for the following elements:
h1,h2,h3,h4,ul,ol,quote, andcode_block.
You can just clone the starter template and write your own book.
Install library:
gem install philomathPrepare markdown files for your book and make it happen:
chapters = [
{
name: 'Introduction',
file_path: './book/introduction.md'
},
{
name: 'Getting started',
file_path: './book/getting_started.md'
}
]
Philomath.render(chapters: chapters, output_path: 'book.pdf')You can also use config file, look at book.yml and then just call:
Philomath.render_from_config(output_path: 'book.pdf')You can also specify a cover image for your book. The best result you will achieve with .png file with dimensions 1540x1990:
chapters = [ ... ]
Philomath.render(chapters: chapters, output_path: 'book.pdf', cover_image: 'cover.png')
# or add cover_image attribute to config