1
0
mirror of https://github.com/lise-henry/crowbook synced 2024-11-18 00:13:55 +01:00
Converts books written in Markdown to HTML, LaTeX/PDF and EPUB
Go to file
Elisabeth Henry b8b6fe68dd Fix EPUB rendering issues
- Remove the need to have named chapter titles in EPUB

- Cover was previously listed twice in content.opf, fixed that
2016-03-01 19:12:16 +01:00
book_example Update documentation 2016-03-01 18:46:59 +01:00
ci added back the test of the executable in ci/script.sh 2016-02-23 15:18:25 +01:00
src Fix EPUB rendering issues 2016-03-01 19:12:16 +01:00
templates Fix typo in epub stylesheet 2016-03-01 19:10:57 +01:00
tests Make Book parse inline yaml blocks, not just ignoring them. 2016-03-01 16:00:43 +01:00
.gitignore Added doc-pak to .gitignore 2016-03-01 04:09:39 +01:00
.travis.yml .travis.yml: reverted to original 2016-02-26 14:42:40 +01:00
appveyor.yml updated .travis.yml and appveyor.ml to build a little less configurations 2016-02-23 22:13:03 +01:00
Bugs.md updated Bugs and Changelog 2016-02-29 14:12:47 +01:00
Cargo.toml Crowbook now ignores YAML blocks (i.e., delimited by two lines containing ---, must contain valid YAML) in Markdown files 2016-03-01 01:28:36 +01:00
ChangeLog.md Update ChangeLog.md 2016-03-01 18:08:06 +01:00
config.book updated config.book 2016-02-27 04:41:38 +01:00
description-pak Added description-pak file (useful for checkinstall). 2016-03-01 04:07:09 +01:00
LICENSE.md added license and bugs to config.book 2016-02-26 23:37:55 +01:00
Makefile Fixed an espacing error in Makefile 2016-02-29 14:05:29 +01:00
README.md Update documentation 2016-03-01 18:46:59 +01:00

Crowbook

Build Status

Render a markdown book in HTML, Epub or PDF.

Crowbook's purpose is to allow you to automatically generate multiple outputs formats from a book written in Markdown. Its main focus is novels, and the default settings should (hopefully) generate readables book with correct typography.

Installing

There are two ways to get crowbook: either use a precompiled binary or build it yourself.

Binaries

See the releases page to download a precompiled binary for your architecture (currently: Linux, Windows and MacOSX). Just extract the archive and run crowbook (or crowbook.exe on Windows). You might also want to copy the binary somewhere in your PATH for later usage.

Building

You'll need to have the Rust compiler on your machine first; you can download and install it here. Once it is down:

$ cargo install crowbook

will automatically download the latest crowbook release on crates.io and install it.

Usage

The simplest command is:

$ crowbook <BOOK>

Where BOOK is a configuration file. Crowbook will then parse this file and generate a book in HTML, Epub, LaTeX, and/or PDF, according to the settings in the configuration file. So if you clone this repository and run

$ crowbook book_example/config.book

you'll generate the example book in various formats. The HTML version should look like that.

To create a new book, assuming you have a list of Markdown files, you can generate a template configuration file with the --create argument:

$ crowbook --create my.book chapter_*.md

This will generate a default my.book file, which you'll need to complete.

This configuration file contains some metadata, options, and lists the Markdown files. Here is a basic example:

author: Joan Doe
title: Some book
lang: en

output_html: some_book.html

+ chapter_1.md
+ chapter_2.md
+ chapter_3.md
+ ...

For more information see the configuration file page, or the whole book_example source directory. (A (not necessarily up-to-date) rendered version is available in HTML here).

It is also possible to give additional parameters to crowbook; we have already seen --create, but if you want the full list, see the arguments page.

Current features

Output formats

Crowbook (to my knowledge) correctly supports HTML and EPUB (either version 2 or 3) as output formats: rendered files should pass respectively the W3C validator and the IDPF EPUB validator for a wide range of (correctly Markdown formatted) input files. See the example book rendered in HTML and EPUB on github.io.

LaTeX output is a bit more tricky: it should work reasonably well for novels (the primary target of Crowbook), but pdflatex might occasionally choke on some "weird" unicode character. Moreover, images are not yet implemented (but should come soon). See the example book rendered in PDF on github.io.

ODT output is experimental at best. It might work if your inputs files only include very basic formatting (basically, headers, emphasis and bold), it will probably look ugly in the rest of the cases, and it might miserably fail in some. See the example book rendered in ODT on github.io if you want to hurt your eyes.

Input format

Crowbook uses pulldown-cmark and thus should support most of CommonMark Markdown. Inline HTML, however, is not implemented, and probably won't be, as the goal is to have books that can also be generated in PDF (and maybe eventually ODT).

Maybe the most specific "feature" of Crowbook is that (by default, it can be deactivated) it tries to "clean" the input files. By default this doesn't do much (except removing superfluous spaces), but if the book's language is set to french it tries to respect french typography, replacing spaces with non-breaking ones when it is appropriate (e.g. in french you are supposed to put a non-breaking space before '?', '!', ';' or ':'). This feature is relatively limited at the moment, but I might try to add more options and support for more languages.

Crowbook tries to correctly translate local links in the input Markdown files: e.g. if you have a link to a markdown file that is part of your book, it will be transformed into a link inside the document.

See also Bugs.

Acknowledgements

Besides the Rust compiler and standard library, Crowbook uses the following libraries:

It also uses configuration files from rust-everywhere to use [Travis]]https://travis-ci.org/) and Appveyor to generate binaries for various platforms on each release.

While Crowbook directly doesn't use them, there was also inspiration from Pandoc and mdBook.

Also, the W3C HTML validator and the IDPF EPUB validator proved very useful during development.

ChangeLog

See ChangeLog.

Library

While the main purpose of Crowbook is to be runned as a command line, the code is written as a library, so if you want to build on it you can use it as such. The code is currently badly documented (and badly in a general manner), but you can look at the generated documentation here.

License

Crowbook is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL), version 2.1 or (at your option) any ulterior version. See LICENSE file for more information.