1
0
mirror of https://github.com/lise-henry/crowbook synced 2024-12-04 06:38:22 +01:00
Converts books written in Markdown to HTML, LaTeX/PDF and EPUB
Go to file
Lizzie Crowdagger 4d29f7d960
Merge pull request #127 from habi/patch-1
lise-henry -> crowdagger
2024-11-18 21:47:53 +01:00
.github Update FUNDING.yml 2024-03-14 03:07:39 +01:00
ci Fix(?) travis config 2020-07-07 10:43:42 +02:00
docs/book Fix typos 2024-10-20 00:43:44 +08:00
guide Fix typos 2024-10-20 00:43:44 +08:00
img Add small version of crowbook logo 2017-07-14 19:39:49 +02:00
lang Fix string name typo 2024-11-18 21:46:29 +01:00
src Fix typos 2024-10-20 00:43:44 +08:00
templates Fix typos 2024-10-20 00:43:44 +08:00
tests Fix typos 2024-10-20 00:43:44 +08:00
.gitignore Add crowbook.pot files to .gitignore 2016-12-30 00:52:57 +01:00
.travis.yml Fix travis token? 2020-07-07 14:07:32 +02:00
appveyor.yml Use latest version of trust to try and build stuff 2019-12-13 12:17:57 +01:00
Cargo.lock Update Cargo.lock 2024-05-11 05:27:05 +02:00
Cargo.toml Remove crowbook-intl dependencies 2023-08-20 05:51:42 +02:00
ChangeLog.md Fix typos 2024-10-20 00:43:44 +08:00
description-pak Remove errors due migration to edition 2021. 2022-01-15 21:17:30 +01:00
guide.book Fix typos 2024-10-20 00:43:44 +08:00
LICENSE.md Update documentation 2016-03-01 21:41:23 +01:00
Makefile Update Makefile 2019-07-19 03:31:48 +02:00
README.md lise-henry -> crowdagger 2024-10-29 16:34:59 +01:00
Roadmap.md Fix: Remove trailing whitespace 2020-01-08 18:37:03 +01:00

Crowbook

Crowbook's aim is to allow you to write a book in Markdown without worrying about formatting or typography, and let the program generate HTML, PDF and EPUB output for you. Its focus is novels and fiction, and the default settings should (hopefully) generate readable books with correct typography without requiring you to worry about it.

Example

To see what Crowbook's output looks like, you can read the Crowbook guide rendered in HTML, PDF or EPUB.

Installing

There are two ways to install Crowbook: either using precompiled binaries, or compiling it using cargo.

Binaries

See the releases page to download a precompiled binary for your architecture. 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.

Using Cargo

Cargo is the package manager for Rust. You can install it here. Once that is done:

$ cargo install crowbook

will automatically download the latest crowbook release on crates.io, compile it, and install it on your system.

Some dependencies also require building C libraries; you might thus also need to install a C compiler and make/cmake build tools.

Dependencies

While there should be, strictly speaking, no real dependencies to be able to run Crowbook (it is published as a statically compiled binary), PDF rendering requires a working installation of LaTeX (preferably xelatex).

Quick tour

The simplest command is:

$ crowbook <BOOK>

where BOOK is a configuration file. Crowbook will parse this file and generate HTML, EPUB, and/or PDF output formats, according to the settings in the configuration file.

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 my.book --create 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.

For short books containing only a single Markdown file, it is possible to embed some metadata at the beginning of the file and use the --single or -s option to run crowbook directly on this Markdown file and avoid creating a separate book configuration file:

$ crowbook -s text.md

For more information, see the chapters on the arguments supported by crowbook and on the configuration file.

Current features

Output formats

Crowbook supports HTML, PDF and EPUB (either version 2 or 3) as output formats. See the Crowbook User Guide rendered in HTML, EPUB and PDF.

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 ODT).

Typographic "cleaning"

Maybe the most specific "feature" of Crowbook is that it does its best to "clean" the input text before rendering it. By default, it removes superfluous spaces and tries to use curly quotes. If the book's language is set to french, it also tries to respect french typography by replacing spaces with non-breaking ones when it is appropriate (e.g. before '?', '!', ';' or ':').

Please open an issue describing typographic rules if you want them to be implemented for other 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.

Inline YAML blocks

Crowbook supports inline YAML blocks:

---
author: Me
title: My title
---

This is mostly useful when Crowbook is run with the --single argument (receiving a single Markdown file instead of a book configuration file), for short texts that only contain one "chapter".

Customization

While the default settings will hopefully generate something that should look "good enough", it is possible to customize the output, essentially by providing different templates.

Bugs

See the issue tracker on GitHub.

Contributors

crowdagger
Lizzie Crowdagger
stefan0xC
Stefan Melmuk
hirschenberger
Falco Hirschenberger
d0whc3r
D0wHc3r
jrappen
Johannes Rappen
dkotrada
Alfa
hfiguiere
Hubert Figuière
ar1ocker
Ar1oc
twirrim
Twirrim
sigurdsvela
Sigurd Svela
mgeisler
Martin Geisler
kianmeng
Kian-Meng Ang
cuviper
Josh Stone
Geobert
Geobert Quach
steffahn
Frank Steffahn
Dylan-DPC
Dylan DPC
dvalter
Dmitry Valter

Acknowledgements

Besides the Rust compiler and standard library, Crowbook uses the following libraries: pulldown-cmark, yaml-rust, mustache, clap, chrono, uuid, mime_guess, crossbeam, walkdir, rustc-serialize, caribon, hyper, url, lazy_static, regex, term, numerals, syntect.

It can also embed Highlight.js in HTML output to enable syntax highlighting for code blocks.

It also uses configuration files from rust-everywhere to use Travis 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 to be very useful during development and testing.

ChangeLog

See ChangeLog.

Contributing

See how you can contribute to Crowbook.

If you find this project useful, you can also support its author by making a Paypal donation.

Library

While the main purpose of Crowbook is to be run as a standalone program, the code is written as a library, so if you want to build on it you can use it as such. You can look at the generated documentation on docs.rs.

Note that, in order to facilitate code reuse, some features have been split to separate libraries:

  • epub-builder makes it easier to generate EPUB files.
  • crowbook-text-processing contains all the "typographic" functions (smart quotes, handling of non-breaking spaces in french, ...).

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 later version. See LICENSE for more information.

Crowbook's logo is licensed under the Creative Commons Attribution 4.0 International license, based on the Rust logo by Mozilla Corporation.

Crowbook includes binary (minified) CSS and Javascript files from Highlight.js, written by Ivan Sagalaev, see license