2016-02-21 20:33:30 +01:00
|
|
|
Arguments
|
|
|
|
=========
|
|
|
|
|
|
|
|
Crowbook can takes a list of arguments:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
Render a markdown book in Epub, PDF or HTML.
|
|
|
|
|
|
|
|
USAGE:
|
2016-03-01 18:46:59 +01:00
|
|
|
crowbook [FLAGS] [OPTIONS] [--] [ARGS]
|
|
|
|
|
|
|
|
FLAGS:
|
2016-03-01 21:41:23 +01:00
|
|
|
-h, --help Prints help information
|
|
|
|
-l, --list-options Lists all possible option
|
|
|
|
-s, --single Use a single Markdown file instead of a book configuration file
|
|
|
|
-V, --version Prints version information
|
|
|
|
-v, --verbose Print warnings in parsing/rendering
|
2016-02-21 20:33:30 +01:00
|
|
|
|
|
|
|
OPTIONS:
|
2016-03-01 21:41:23 +01:00
|
|
|
-c, --create <FILES>... Creates a new book with existing markdown files
|
|
|
|
-o, --output <FILE> Specifies output file
|
|
|
|
--print-template <TEMPLATE> Displays the default value of a template
|
2016-03-01 18:46:59 +01:00
|
|
|
--set <KEY_VALUES> Sets a list of book options
|
2016-03-01 21:41:23 +01:00
|
|
|
-t, --to <FORMAT> Generate specific forma [values: epub, pdf, html, tex, odt]
|
2016-02-21 20:33:30 +01:00
|
|
|
|
|
|
|
ARGS:
|
2016-03-01 21:41:23 +01:00
|
|
|
<BOOK> File containing the book configuration, or a Markdown file when called with --single
|
2016-02-23 23:12:36 +01:00
|
|
|
```
|
2016-02-21 20:33:30 +01:00
|
|
|
|
2016-02-23 23:12:36 +01:00
|
|
|
Note that Crowbook generates output files relatively to the directory
|
|
|
|
where <BOOK> is:
|
|
|
|
```
|
2016-02-21 20:33:30 +01:00
|
|
|
$ crowbook foo/bar.book --to pdf --output baz.pdf
|
|
|
|
```
|
2016-02-23 23:12:36 +01:00
|
|
|
will thus generate baz.pdf in directory foo and not in current directory.
|
2016-02-21 20:33:30 +01:00
|
|
|
|
2016-02-23 23:12:36 +01:00
|
|
|
The most important option obviously <BOOK>, i.e. the file
|
|
|
|
configuration book. It is mandatory for most options: if you don't
|
|
|
|
pass it, `crowbook`
|
2016-02-21 20:33:30 +01:00
|
|
|
will simply display this help message. In a normal use case this is
|
|
|
|
the only argument you'll need to pass, and `crowbook` will generate
|
|
|
|
the book in all formats specified in the configuration file.
|
|
|
|
|
|
|
|
It is, however, possible to pass more arguments to `crowbook`.
|
|
|
|
|
|
|
|
`--create`
|
|
|
|
---------
|
|
|
|
|
2016-02-23 23:12:36 +01:00
|
|
|
**Usage**: `crowbook [BOOK] --create file_1.md file_2.md ...`
|
2016-02-21 20:33:30 +01:00
|
|
|
|
2016-02-23 23:12:36 +01:00
|
|
|
Creates a new book from a list of Markdown files. It will generate a
|
2016-03-01 21:41:23 +01:00
|
|
|
book configuration file with all file names specified as
|
|
|
|
chapters. It either prints the result to stdout (if `BOOK` is not
|
2016-02-23 23:12:36 +01:00
|
|
|
specified) or generate the file `BOOK` (or abort if it already
|
|
|
|
exists).
|
2016-02-21 20:33:30 +01:00
|
|
|
|
2016-02-22 04:51:27 +01:00
|
|
|
### Examples ###
|
2016-02-21 20:33:30 +01:00
|
|
|
|
|
|
|
```
|
2016-02-23 23:12:36 +01:00
|
|
|
crowbook foo.book --create README.md ChangeLog.md LICENSE.md
|
2016-02-21 20:33:30 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
will generate a file `foo.book` containing:
|
|
|
|
|
|
|
|
```
|
|
|
|
author: Your name
|
|
|
|
title: Your title
|
|
|
|
lang: en
|
|
|
|
|
|
|
|
# Uncomment and fill to generate files
|
|
|
|
# output.html: some_file.html
|
|
|
|
# output.epub: some_file.epub
|
|
|
|
# output.pdf: some_file.pdf
|
|
|
|
|
|
|
|
# Uncomment and fill to set cover image (for Epub)
|
|
|
|
# cover: some_cover.png
|
|
|
|
|
|
|
|
# List of chapters
|
|
|
|
+ README.md
|
|
|
|
+ ChangeLog.md
|
|
|
|
+ LICENSE.md
|
|
|
|
```
|
|
|
|
|
2016-02-23 23:12:36 +01:00
|
|
|
while
|
|
|
|
|
|
|
|
```
|
|
|
|
crowbook --create README.md ChangeLog.md LICENSE.md
|
|
|
|
```
|
|
|
|
|
|
|
|
will prints the same result, but to stdout (without creating a file).
|
|
|
|
|
2016-02-22 04:51:27 +01:00
|
|
|
When `crowbook` is runned with `--create`, it can also uses the
|
|
|
|
keys/values set by `--set` (see below):
|
|
|
|
|
|
|
|
```
|
2016-03-01 18:46:59 +01:00
|
|
|
$ crowbook foo.book --create file1.md file2.md --set author "Pierre Dupont" title "Mon Å“uvre" lang fr
|
2016-02-22 04:51:27 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
will generate a `foo.book` file containing
|
|
|
|
|
|
|
|
```
|
|
|
|
author: Pierre Dupont
|
2016-02-25 19:26:49 +01:00
|
|
|
title: Mon Å“uvre
|
2016-02-22 04:51:27 +01:00
|
|
|
lang: fr
|
|
|
|
|
|
|
|
# List of chapters
|
|
|
|
+ file1.md
|
|
|
|
+ file2.md
|
|
|
|
```
|
|
|
|
|
2016-03-01 18:46:59 +01:00
|
|
|
`--single`
|
|
|
|
----------
|
|
|
|
|
|
|
|
**usage**: `crowbook --single <FILE>`
|
|
|
|
|
|
|
|
(or `crowbook -s <FILE>`)
|
|
|
|
|
|
|
|
This options allows to pass `crowbook` a single Markdown file. This
|
|
|
|
file can contain an inline YAML block to set some book options. Inline
|
|
|
|
YAML blocks must start and end with a line with `---` (three dashes). E.g:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
---
|
|
|
|
author: Joan Doe
|
|
|
|
title: A short story
|
|
|
|
---
|
|
|
|
```
|
|
|
|
|
|
|
|
If this YAML block is not at the beginning of a file, it must also be
|
|
|
|
preceded by a blank line.
|
|
|
|
|
2016-03-01 21:41:23 +01:00
|
|
|
This allows to not have to write a `.book` configuration file for a
|
2016-03-01 18:46:59 +01:00
|
|
|
short story or an article. `crowbook --single foo.md` is rougly equivalent to having a book
|
|
|
|
configuration file containing:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
! foo.md
|
|
|
|
```
|
|
|
|
|
|
|
|
That is, the chapter heading (if any) won't be displayed in the output
|
|
|
|
documents (though they still appear in the TOC).
|
|
|
|
|
2016-02-22 02:44:13 +01:00
|
|
|
`--set`
|
|
|
|
-------
|
|
|
|
|
2016-03-01 21:41:23 +01:00
|
|
|
**usage**: `crowbook <BOOK> --set [KEY] [VALUE]...`
|
2016-02-22 02:44:13 +01:00
|
|
|
|
2016-02-22 04:20:28 +01:00
|
|
|
This options takes a list `KEY` `VALUE` pairs and allows to set or
|
|
|
|
override a book configuration option. All valid options in the
|
2016-02-22 03:26:39 +01:00
|
|
|
configuration files are valid as keys. For more information, see
|
2016-03-01 21:41:23 +01:00
|
|
|
[the configuration file](config.md).
|
2016-02-22 02:44:13 +01:00
|
|
|
|
2016-02-22 03:26:39 +01:00
|
|
|
### Examples ###
|
2016-02-22 02:44:13 +01:00
|
|
|
|
|
|
|
```
|
2016-02-22 04:20:28 +01:00
|
|
|
$ crowbook foo.book --set html.css style.css
|
2016-02-22 02:44:13 +01:00
|
|
|
```
|
|
|
|
|
2016-02-22 04:20:28 +01:00
|
|
|
will override the CSS for HTML generation (the `html.css` key) to `style.css`.
|
2016-02-22 02:44:13 +01:00
|
|
|
|
2016-02-22 03:26:39 +01:00
|
|
|
```
|
2016-02-22 04:20:28 +01:00
|
|
|
$ crowbook foo.book --set author Foo --title Bar
|
2016-02-22 03:26:39 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
will override the book title to `Bar` and its author to `Foo`.
|
|
|
|
|
2016-02-23 23:20:21 +01:00
|
|
|
`--list-options`
|
|
|
|
----------------
|
|
|
|
|
|
|
|
**usage**: `crowbook --list-options`
|
|
|
|
|
|
|
|
(or `crowbook -l`)
|
|
|
|
|
2016-03-01 21:41:23 +01:00
|
|
|
Displays all the valid options to use, whether in a book configuration
|
|
|
|
file, with `--set`, or in an inline YAML block.
|
2016-02-25 15:52:46 +01:00
|
|
|
|
|
|
|
`--print-template`
|
|
|
|
------------------
|
|
|
|
|
|
|
|
**usage**: `crowbook --print-template template`
|
|
|
|
|
|
|
|
Prints to stdout the built-in template. Useful if you want to
|
|
|
|
customize the appearance of your document. E.g., if you want to modify
|
|
|
|
the CSS used for HTML rendering:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ crowbook --print-template html.css > my_style.css
|
|
|
|
# edit my_style.css in your favourite editor
|
|
|
|
$ crowbook my.book --set html.css my_style.css
|
|
|
|
# or add "html.css: my_style.css" in my.book
|
|
|
|
```
|
|
|
|
|
|
|
|
Note that it is possible to use this option in conjonction with
|
|
|
|
`--set`, though it is currently only useful for EPUB template:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ crowbook --print-template epub.template --set epub.version 2
|
2016-03-01 21:41:23 +01:00
|
|
|
# Returns the template for Epub 2 (currently it is the default one)
|
2016-02-25 15:52:46 +01:00
|
|
|
$ crowbook --print-template epub.template --set epub.version 3
|
|
|
|
# Returns the template for Epub 3
|
|
|
|
```
|
2016-02-23 23:20:21 +01:00
|
|
|
|
|
|
|
|
2016-02-21 20:33:30 +01:00
|
|
|
`--verbose`
|
|
|
|
-----------
|
|
|
|
|
2016-02-23 23:20:21 +01:00
|
|
|
**usage**: `crowbook <BOOK> --verbose`
|
2016-02-21 20:33:30 +01:00
|
|
|
|
2016-03-01 21:41:23 +01:00
|
|
|
If this flag is set, Crowbook will print the warnings it detect while
|
|
|
|
parsing and rendering. These warnings are typically related to the
|
|
|
|
inclusion of non-local images, linking to Markdown files that are not
|
|
|
|
part of the book, and so on.
|
2016-02-21 20:33:30 +01:00
|
|
|
|
|
|
|
`--to`
|
|
|
|
------
|
|
|
|
|
2016-02-22 04:51:27 +01:00
|
|
|
**usage**: `crowbook <BOOK>--to [FORMAT]`
|
2016-02-21 20:33:30 +01:00
|
|
|
|
2016-02-22 04:51:27 +01:00
|
|
|
(or `crowbook <BOOK> -t [FORMAT]`)
|
2016-02-21 20:33:30 +01:00
|
|
|
|
|
|
|
Generate only the specified format. `FORMAT` must be either `epub`,
|
|
|
|
`pdf`, `html`, `odt` or `tex`.
|
|
|
|
|
|
|
|
If an output file for the format is not specified in the book
|
|
|
|
configuration file, `crowbook` will fail to render PDF, ODT and Epub
|
|
|
|
(whereas it will print HTML and Tex files on stdout). It is however
|
|
|
|
possible to specify a file with the `--output` option.
|
|
|
|
|
|
|
|
### Examples ###
|
|
|
|
|
|
|
|
```
|
|
|
|
crowbook --to html foo.book
|
|
|
|
```
|
|
|
|
|
|
|
|
will generate some HTML, and prints it either to the file specified by
|
2016-03-01 21:41:23 +01:00
|
|
|
`output.html` in `foo.book`, or to stdout if it is not specified.
|
2016-02-21 20:33:30 +01:00
|
|
|
|
|
|
|
```
|
|
|
|
crowbook --to pdf --output foo.pdf foo.book
|
|
|
|
```
|
|
|
|
|
2016-03-01 21:41:23 +01:00
|
|
|
will generate a `foo.pdf` file,.
|
2016-02-21 20:33:30 +01:00
|
|
|
|
|
|
|
`--output`
|
|
|
|
---------
|
|
|
|
|
2016-02-22 04:51:27 +01:00
|
|
|
**usage**: `crowbook <BOOK> --to <FORMAT> --output <FILE> `
|
2016-02-21 20:33:30 +01:00
|
|
|
|
|
|
|
(or `crowbook -t <FORMAT> -o <FILE> <BOOK>`)
|
|
|
|
|
|
|
|
Specifies an output file. Only valid when `--to` is used.
|
|
|
|
|
|
|
|
Note that Crowbook generates output files relatively to the directory
|
|
|
|
where `BOOK` is:
|
|
|
|
```
|
|
|
|
$ crowbook foo/bar.book --to pdf --output baz.pdf
|
|
|
|
```
|
|
|
|
will thus generate `baz.pdf` in directory `foo` and not in current
|
|
|
|
directory.
|