Skip to content
Georg Jähnig edited this page Aug 20, 2018 · 2 revisions

Definition files

Usage

A definition file contains the setup of an ebook. Use one ore more of them, the latter overrides the former:

node index.js definitions/1.yml definitions/2.yml ...

Note: definitions/defaults.yml is always included (first).

Syntax

Definition files are in YAML format.

Keys

shortname

Example:

shortname: my-favourite-blog

This is how the EPUB file will be named (without suffix).

metadata

Example:

metadata:
  dc:
    title: My favourite blog
    creator: My nice author
    language: en-US

An object creating the EPUB metadata. This will create:

<dc:title>My favourite blog</dc:title>
<dc:creator>My nice author</dc:creator>
<dc:language>en-US</dc:language>
tags

Example:

tags:
  title: h2

Which HTML tag shall be used for the titles of the downloaded data. Defaults to h1.

Use h2 if you add raw HTML section titles with <h1> (see below).

modify

Example:

modify:
  content:
  - search: 'foo'
    flags: mg
    replace: 'bar'
  title:
  - search: 'baz'
    flags: g
    replace: 'boo'

List of regexes that shall be applied to the downloaded data. Element names can be content, title, url.

content
content:
- raw: '<h1>First section</h1>'
- http://example.com/1
- http://example.com/2
- raw: '<h1>Second section</h1>'
- http://example.com/3

Array of data to be downloaded or used with in the EPUB.

Can be

  • a string, then it is assumed to be a URL to download.
  • an object, then the content of raw: is written to the EPUB.
Clone this wiki locally