TXT 转 EPUB

安装 calibre

/images/posts/TXT转EPUB/1.png
(图1)

txt 乱码

使用 vscode 打开转换编码

/images/posts/TXT转EPUB/13.png
(图13)
/images/posts/TXT转EPUB/14.png
(图14)

txt 文本间隔一行

1
2
3
([。”!?;])[\u3000 ]*\r?\n

$1\n\n

转换

  1. 添加书籍
/images/posts/TXT转EPUB/2.png
(图2)

  1. 转换书籍
/images/posts/TXT转EPUB/3.png
(图3)
/images/posts/TXT转EPUB/4.png
(图4)
/images/posts/TXT转EPUB/5.png
(图5)
/images/posts/TXT转EPUB/6.png
(图6)
/images/posts/TXT转EPUB/7.png
(图7)
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
/* Sspai Web Theme A theme to [sspai](ssp.ai) default theme. Developed by Codegass(wchweichenhao@gmial.com) & Yves(yves@sspai.com) Download Cuto on the App Store and Google Play! */

body {
	font-size: 15px;
	color: #333;
	background: #fff;
	font-family: Helvetica, Arial, "PingFang SC", "Microsoft YaHei", "WenQuanYi Micro Hei", "tohoma,sans-serif";
	margin: 0;
	padding: 10%;
}
h1 {
	font-size: 2.2em;
	font-weight: 700;
	line-height: 1.1;
	padding-top: 16px;
	margin-bottom: 4px;
}
h2, h3, h4, h5, h6 {
	line-height: 1.5em;
	margin-top: 2.2em;
	margin-bottom: 4px;
}
h2 {
	font-size: 1.4em;
	margin: 40px 10px 20px 0;
	padding-left: 9px;
	border-left: 6px solid #ff7e79;
	font-weight: 700;
	line-height: 1.4;
}
h3 {
	font-weight: 700;
	font-size: 1.2em;
	line-height: 1.4;
	margin: 10px 0 5px;
	padding-top: 10px;
}
h4 {
	font-weight: 700;
	text-transform: uppercase;
	font-size: 1.1em;
	line-height: 1.4;
	margin: 10px 0 5px;
	padding-top: 10px
}
h5, h6 {
	font-size: .9em;
}
h5 {
	font-weight: bold;
	text-transform: uppercase;
}
h6 {
	font-weight: normal;
	color: #AAA;
}
img {
	width: 100%;
	border-radius: 5px;
	display: block;
	margin-bottom: 15px;
	height: auto;
}
dl, ol, ul {
	margin-top: 12px;
	margin-bottom: 20px;
	padding-left: 5%;
	line-height: 1.8;
}
p {
	margin: 0 0 20px;
	padding: 0;
	line-height: 1.8;
}
a {
	color: #f22f27;
	text-decoration: none;
}
a:hover {
	color: #f55852;
	text-decoration: underline;
}
a:focus {
	outline-offset: -2px;
}
blockquote {
	font-size: 1em;
	font-style: normal;
	padding: 30px 38px;
	margin: 0 0 15px;
	position: relative;
	line-height: 1.8;
	text-indent: 0;
	border: none;
	color: #888;
}
blockquote:before {
	content: "“";
	left: 12px;
	top: 0;
	color: #E0E0E0;
	font-size: 4em;
	font-family: Arial, serif;
	line-height: 1em;
	font-weight: 700;
	position: absolute;
}
blockquote:after {
	content: "”";
	right: 12px;
	bottom: -26px;
	color: #E0E0E0;
	font-size: 4em;
	font-family: Arial, serif;
	line-height: 1em;
	font-weight: 700;
	position: absolute;
	bottom: -31px;
}
strong, dfn {
	font-weight: 700;
}
em, dfn {
	font-style: italic;
	font-weight: 400;
}
del {
	text-decoration: line-through;
}
/*code {font-size:90%;}*/

/*pre {text-align:left; overflow-x: scroll; color: #257fa0; background: #f6f6f6; padding: 10pt 15pt; border-radius: 3px; border: solid 1px #e2e2e2;}*/

pre {
	margin: 0 0 10px;
	font-size: 13px;
	line-height: 1.42857;
	word-break: break-all;
	word-wrap: break-word;
	border-radius: 4px;
	white-space: pre-wrap;
	display: block;
	background: #f8f8f8;
	padding: 10px 20px;
	border: none;
	margin-bottom: 25px;
	color: #666;
	font-family: Courier, sans-serif;
}
code {
	color: #c7254e;
	background-color: #f9f2f4;
	border-radius: 4px;
	font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
	padding: 2px 4px;
	font-size: 90%;
}
p>code {
	color: #c7264e;
	background-color: #f9f2f4;
	font-size: .95em;
	border-radius: 3px;
	-moz-border-radius: 3px;
	-webkit-border-radius: 3px;
}
figure {
	margin: 1em 0;
}
figcaption {
	font-size: 0.75em;
	padding: 0.5em 2em;
	margin-bottom: 2em;
}
figure img {
	margin-bottom: 0px;
}
hr {
	margin-top: 20px;
	margin-bottom: 20px;
	border: 0;
	border-top: 1px solid #eee;
}
ol p, ul p {
	margin-bottom: 0px;
}
li {
	margin-bottom: 0.75em;
	margin-top: 0.75em;
}
ol#footnotes {
	font-size: 0.95em;
	padding-top: 1em;
	margin-top: 1em;
	margin-left: 0;
	border-top: 1px solid #eaeaea;
	counter-reset: footer-counter;
	list-style: none;
	color: #555;
	padding-left: 5%;
	margin: 20px 0;
}
ol#footnotes li {
	margin-bottom: 10px;
	margin-left: 16px;
	font-weight: 400;
	line-height: 2;
	list-style-type: none;
}
ol#footnotes li:before {
	content: counter(footer-counter) ". ";
	counter-increment: footer-counter;
	font-weight: 800;
	font-size: .95em;
}
@keyframes highfade {
	0% {
		background-color: none;
	}
	20% {
		background-color: yellow;
	}
	100% {
		background-color: none;
	}
}
@-webkit-keyframes highfade {
	0% {
		background-color: none;
	}
	20% {
		background-color: yellow;
	}
	100% {
		background-color: none;
	}
}
a:target, ol#footnotes li:target, sup a:target {
	animation-name: highfade;
	animation-duration: 2s;
	animation-iteration-count: 1;
	animation-timing-function: ease-in-out;
	-webkit-animation-name: highfade;
	-webkit-animation-duration: 2s;
	-webkit-animation-iteration-count: 1;
	-webkit-animation-timing-function: ease-in-out;
}
a:target {
	border: 0;
	outline: 0;
}
animation-iteration-count: 1;
-webkit-animation-timing-function: ease-in-out;
}
a:target {
	border: 0;
	outline: 0;
}
tion-iteration-count: 1;
-webkit-animation-timing-function: ease-in-out;
}
a:target {
	border: 0;
	outline: 0;
}
/images/posts/TXT转EPUB/8.png
(图8)
/images/posts/TXT转EPUB/9.png
(图9)
1
//*[re:test(., "^\s*[第卷][0123456789一二三四五六七八九十零〇百千两]*[章回幕部节集卷].*", "i")]

如果生成的目录有问题,勾选 在转换完成手动手动精细调整目录

/images/posts/TXT转EPUB/10.png
(图10)

编辑元数据

/images/posts/TXT转EPUB/11.png
(图11)
/images/posts/TXT转EPUB/12.png
(图12)
1
2
3
4
5
6
<div style="line-height: 1.4; margin: 0; padding: 0;">
  这是第一行简介内容<br>
  这是第二行简介内容<br>
  这是第三行简介内容<br>
  最后一行简介内容
</div>

替换目录标签

将目录标签 <p> 改为 <h2>

/images/posts/TXT转EPUB/15.png
(图15)
/images/posts/TXT转EPUB/16.png
(图16)
/images/posts/TXT转EPUB/17.png
(图17)
1
2
3
<p id="calibre_toc_([0-9]+)" class="calibre2">([^<]+)</p>

<h2 id="calibre_toc_\1" class="calibre2">\2</h2>

0%