jEpub
Simple EPUB builder library, works in modern browsers.
Demo
Installation
npm install --save jepub
You can also use it via a CDN:
or:
Dependencies
jEpub requires JSZip and EJS. Make sure these libraries are loaded before starting your code.
Usage
jepub.init
- i18n only include the language codes defined in
i18n.json
- description: HTML string.
- tags: Array.
Set published date
jepub.datedate: object
- date: Date Object.
Set identifier
jepub.uuidid: string | number
- id: Unique id.
Add cover
jepub.coverdata: object
- data: A Blob or an ArrayBuffer object from XMLHttpRequest.
Add notes
jepub.notescontent: string
- content: HTML string.
*
Add chapter jepub.addtitle: string, content: string | array
- title: Plain text.
- content:
string
: HTML string.array
: Plain text for each item.
Add image
jepub.imagedata: object, IMG_ID: string
- data: A Blob or an ArrayBuffer object from XMLHttpRequest.
- IMG_ID: Unique id.
Place <%= image[IMG_ID] %>
inside the chapter's content (HTML string only), where you want to display it.
*
Generate EPUB jepub.generatetype = 'blob', onUpdate?: void
- type: The type of EPUB to return. See JSZip type option.
- onUpdate: (optional) Callback function. See JSZip onUpdate callback.
+
Static methods Convert HTML to text
jEpub.html2texthtml: string, noBr = false
- html: HTML string.
- noBr: Boolean. Add line break after Block-level elements.
Development
npm start
Builds are concatenated and minified using Webpack and Babel.
npm run build
License
ISC. Copyright 2018 lelinhtinh