Simple EPUB builder library, works in modern browsers.
Simple EPUB builder library, works in modern browsers.
npm install --save jepub
You can also use it via a CDN:
<script src="https://unpkg.com/jepub/dist/jepub.min.js"></script>
or:
<script src="https://cdn.jsdelivr.net/npm/jepub/dist/jepub.min.js"></script>
jEpub requires JSZip and EJS. Make sure these libraries are loaded before starting your code.
<script src="jszip.js"></script>
<script src="ejs.js"></script>
<script src="jepub.js"></script>
<script>
const jepub = new jEpub()
// jepub.init({
// do something
</script>
const jepub = new jEpub()
jepub.init({
i18n: 'en', // Internationalization
title: 'Book title',
author: 'Book author',
publisher: 'Book publisher',
description: '<b>Book</b> description', // optional
tags: [ 'epub', 'tag' ] // optional
})
i18n.json
jepub.date(date: object)
jepub.uuid(id: string | number)
jepub.cover(data: object)
jepub.notes(content: string)
*
jepub.add(title: string, content: string | array, index?:number)
string
: HTML string.array
: Plain text for each item.jepub.image(data: object, IMG_ID: string)
Place <%= image[IMG_ID] %>
inside the chapter’s content (HTML string only), where you want to display it.
*
jepub.generate(type = 'blob', onUpdate?: metadata => void)
+
jEpub.html2text(html: string, noBr = false)
npm start
Builds are concatenated and minified using Webpack and Babel.
npm run build
ISC. Copyright 2018 lelinhtinh