
用VNote导出markdown笔记供kindle阅读
日常写点笔记我采用vnote这个国产markdown编辑器,在网上遇到有一些解决问题的教程,其中只言片语若对我有价值,常使用拷贝猫这个chrome扩展复制下来,写入笔记供日后参考.vnote编辑器支持多个md文件组合成一个个"笔记本",那么问题来了,如果我想把这些东西搞到kindle上阅读.如何操作?
gitbook(划掉)
gitbook曾经是个不错的选择,发布到gitbook上之后可以以epub、mobi、pdf多种格式下载.但其网站经过改版之后,其软件gitbook-cli也不再维护.不推荐此方法.
mdbook
mdbook是一款用rust写成的,可以用来根据markdown源文件创建在线图书的工具.mdbook和gitbook功能和使用上差不多,可以作为后者的替代品.mdbook-epub作为该项目的衍生,可以创建相应的epub电子书.而epub格式和mobi格式转换比较方便.如果喜欢类似gitbook的工具,可以用mdbook.
cargo install mdbook-epub
warning: be sure to add
/home/curie/.cargo/bin
to your PATH to be able to run the installed binaries
在~/.bashrc里加入
export PATH="$HOME/.cargo/bin:$PATH"
然后source ~/.bashrc
cd到笔记目录,写好SUMMARY.md,然后在book.toml
加上一行
[output.epub]
再运行
mdbook build
可以得到epub格式电子书.
epub2mobi
epub2mobi
cd /path/to/your/epub/dir
python2 epub2mobi.py
就可以生成mobi电子书.
vnote导出功能
vnote的导出功能依赖wkhtmltopdf,我们需要先安装wkhtmltopdf才能正常使用vnote的导出.
安装wkhtmltopdf
官网:https://wkhtmltopdf.org/
sudo apt install wkhtmltopdf
导出为合适大小的pdf
可以看看VNote官网上关于导出功能的说明 选择File->Export,Target format->PDF(All In One),Notes to Export这个选项中可以选择单个md文件还可以选择整个文件夹.这一点比较方便.除此还可以选择导出时渲染的主题. 然而,第一次导出没有成功,报错信息是
Error: This version of wkhtmltopdf is build against an unpatched version of QT, and does not support more then one input document.
原因网上有相关说明
===========================> Reduced Functionality <============================
Some versions of wkhtmltopdf are compiled against a version of QT without the
wkhtmltopdf patches. These versions are missing some features, you can find out
if your version of wkhtmltopdf is one of these by running wkhtmltopdf --version
if your version is against an unpatched QT, you can use the static version to
get all functionality.
Currently the list of features only supported with patch QT includes:
* Printing more then one HTML document into a PDF file.
* Running without an X11 server.
* Adding a document outline to the PDF file.
* Adding headers and footers to the PDF file.
* Generating a table of contents.
* Adding links in the generated PDF file.
* Printing using the screen media-type.
* Disabling the smart shrink feature of webkit.
原因是有些版本的wkhtmltopdf是针对没有wkhtmltopdf补丁的QT版本编译的。 这些版本缺少某些功能.使用apt安装的wkhtmltopdf版本为0.12.4,
解决方法是卸载0.12.4版本的:sudo apt remove wkhtmltopdf
然后安装针对补丁的QT版本编译的0.12.5版本wkhtmltopdf 0.12.5 (with patched qt)
: - 下载wkhtmltopdf 0.12.5 Ubuntu 18.04 (bionic) amd64 - sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb

根据干货|把word转化成kindle格式,只需这5步!, 导出kindle时,一般操作是把上下左右的页边距设置为2毫米,纸张大小设置为9厘米,高度设置为11.7厘米. 这里我们选择A6纸张,由于导出时自带了边角的留空,所以上下左右留空可以都取0. 如果想进一步定制,可以使用pandoc转换工具.
导出效果

效果还可以.禁止套娃?