CLI quickstart
Install
cargo install --git https://github.com/zachhannum/fleuron fleuron-clifleuron fixtures/corpus/pride-and-prejudice.md -c fixtures/styled.css -o book.pdffleuron: fixtures/corpus/pride-and-prejudice.md → book.pdf: 445 pagesMulti-file books
Multiple markdown files can be passed to the CLI. The engine combines all of the files into a single output.
fleuron front.md ch01.md ch02.md ch03.md -o book.pdfThe tree records each file’s name, so a diagnostic points at the file the trouble is in.
Book metadata
One markdown file is a whole book, so its frontmatter is the book’s. Several are chapters, and a chapter’s frontmatter describes the chapter: its title: names that section, and the book is left unnamed. That leaves the work’s own title and author to the command line:
fleuron ch01.md ch02.md ch03.md -o book.pdf \ --title "The Levant Papers" --author "E. Marsh"A flag outranks frontmatter where the two overlap, so you can retitle a single file without editing it.
Where sections begin
A section is what the fragmenter opens a page on, so where sections begin decides the page count before any styling does. --split names the rule:
fleuron manuscript.md -o book.pdf --split 2A heading at level 2 or shallower opens a section, which suits a manuscript that sets parts with # and chapters with ##. The default is --split 1. --split none opens no section at a heading at all, so in a vault of one chapter per file the file is the section.
--dialect sets which markdown is being read: fleuron, commonmark, gfm or obsidian. fleuron is the default: CommonMark, a frontmatter block and attribute lines. Under commonmark a brace run is prose. See the markdown mapping for what each construct becomes and which of them warn.
Adding your own styling
Stylesheets cascade in the order the command line gives them, over the built-in sheet rather than instead of it:
fleuron manuscript.md -o book.pdf -c house.css -c series.cssSo house.css sets the press’s defaults and series.css overrides the handful of things this series does differently. Author CSS outranks the built-in sheet whatever the specificity of the built-in rule, so you never have to out-specify a default you are replacing.
@page { size: 5.5in 8.5in; margin: 48pt 40pt 56pt 60pt; @bottom-center { content: counter(page); font-size: 8pt; }}
book { font-size: 12pt; line-height: 1.5; }h1, h2, h3 { font-size: 20pt; }The CSS subset is everything the engine supports. Anything else becomes a warning on stderr naming the line and column, and the PDF is written regardless.
Fonts
@font-face urls are resolved as paths: first against the directory of the stylesheet that asked for them, then against the working directory.
@font-face { font-family: "House Serif"; src: url("faces/house.ttf");}A face that resolves nowhere warns and the text falls back. See fonts.
Writing an EPUB
If the output path ends in .epub, the CLI writes a reflowable EPUB rather than a PDF. The following example writes the fixture book as an EPUB, with the fixture stylesheet:
fleuron fixtures/gulliver-excerpt.md -o book.epub -c fixtures/styled.cssfleuron: fixtures/gulliver-excerpt.md → book.epub: 1 documentThe summary counts documents rather than pages. There is one document for each section. The reading system on the device makes the pages. The other flags work the same as for a PDF.
The stylesheet goes into the EPUB, less the CSS that describes pages. Fleuron leaves out that CSS with no warning, because the PDF uses it. CSS in an EPUB lists that CSS. EPUB covers what the EPUB holds.
Reading the tree back
To see what the frontend made of a manuscript, which heading opened a section, or where a construct degraded, dump the content tree instead of laying it out:
fleuron manuscript.md --dump-treeIt goes to stdout, and the same manuscript dumps the same bytes every time.
What it prints
The summary line goes to stderr, so fleuron manuscript.md -o /dev/stdout is still a PDF on stdout. Warnings follow it, one per line, and then a count. The reference has the exit codes.