@epubook/core
v0.0.12-beta.2
Published
[](https://www.npmjs.com/package/@epubook/core) [](https://github.com/yjl990
Maintainers
Readme
@epubook/core
The fundamental module of epubook. It provides low-level API for generating EPUB books.
Installation
npm i @epubook/coreUsage
import { Epub, HTML } from '@epubook/core'
const book = new Epub({
title: 'Test Book',
date: new Date('2023-02-01T11:00:00.000Z'),
lastModified: new Date('2023-02-26T11:00:00.000Z'),
creator: 'XLor',
description: 'for test usage',
source: 'imagine'
})
const page = new HTML('start.xhtml', '...')
book.item(page).spine(page).toc([{ title: 'Start', page }])
await book.writeFile('./test.epub')JSX
You can use jsx to create XHTML node.
/** @jsxImportSource @epubook/xml */
import { XHTMLBuilder } from '@epubook/core'
const builder = new XHTMLBuilder()
const xhtml = builder
.appendBody(<h1>Title</h1>)
.appendBody(<p>This is a paragraph</p>)
.build()You can see @epubook/theme for more details.
License
MIT License © 2023 XLor
