Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
gen-epub
提交
9e2a46b7
G
gen-epub
项目概览
OpenDocCN
/
gen-epub
通知
1
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gen-epub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9e2a46b7
编写于
4月 30, 2020
作者:
W
wizardforcel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
2020-04-30 17:59:11
上级
8f769b7b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
68 addition
and
0 deletion
+68
-0
README.md
README.md
+63
-0
history.md
history.md
+5
-0
未找到文件。
README.md
0 → 100644
浏览文件 @
9e2a46b7
# gen-epub
用于生成 EPUB 的小工具。
## 安装
通过 npm(推荐):
```
npm install gen-epub
```
从源码安装:
```
npm install git+https://github.com/apachecn/gen-epub
```
## 导入
```
js
const
genEpub
=
require
(
'
gen-epub
'
)
```
## 函数参考
```
js
genEpub
(
articles
,
imgs
,
name
,
path
)
```
+
`articles: [{title: String, content: String}]`
文章列表,每个文章以对象表示,
`title`
属性为标题(纯文本),
`content`
属性为正文(HTML)。
在正文中引用图片时,将
`<img>`
的
`src`
属性设为
`../Images/{文件名}`
。
+
`imgs: Map{String: Buffer}`
图片字典,键为文件名,值为图片二进制数据。
+
`name: String`
在书籍元信息中显示的书名,默认为`articles[0].title`。
+
`path: String`
保存文件的路径名,默认为当前工作目录下的`name + '.epub'`。
## 协议
本项目基于 SATA 协议发布。
您有义务为此开源项目点赞,并考虑额外给予作者适当的奖励。
## 赞助我们
![](
https://home.apachecn.org/img/about/donate.jpg
)
## 另见
+
[
ApacheCN 学习资源
](
https://docs.apachecn.org/
)
+
[
计算机电子书
](
http://it-ebooks.flygon.net
)
+
[
布客新知
](
http://flygon.net/ixinzhi/
)
history.md
0 → 100644
浏览文件 @
9e2a46b7
# 历史记录
v1.0.0 2020.4.30
+
正式发布
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录