Inspired by GitBook
Markdown Preview Enhanced can output content as ebook (ePub, Mobi, PDF).
To generate ebook, you need to have ebook-convert
installed.
OS X
Download the Calibre Application. After moving the calibre.app to your Applications folder create a symbolic link to the ebook-convert tool:
$ sudo ln -s ~/Applications/calibre.app/Contents/MacOS/ebook-convert /usr/local/bin
Windows
Download and Install the Calibre Application.
Add ebook-convert
to your system path.
An EBook example project can be found here.
You can set up a ebook configuration by simply adding ebook front-matter
into your markdown file.
---
ebook:
title: My EBook
authors: shd101wyy
---
Next right click at the preview, choose Export to Disk
, then choose EBOOK
.
For example:
ebook:
title: My EBook
author: shd101wyy
rating: 5
The following options are provided to help control the look and feel of the output
[true/false]
default: false
, Transliterate unicode characters to an ASCII representation. Use with care because this will replace unicode characters with ASCII[number]
[true/false]
default: false
Disable all rescaling of font sizes.[number]
[number]
default: 72.0
Set the top margin in pts. Default is 72. Setting this to less than zero will cause no margin to be set (the margin setting in the original document will be preserved). Note: 72 pts equals 1 inch[number]
default: 72.0
[number]
default: 72.0
[number]
default: 72.0
[number/array]
default: 72.0
ebook:
margin: 5 # margin-top = margin-right = margin-bottom = margin-left = 5
ebook:
margin: [4, 8] # margin-top = margin-bottom = 4, margin-left = margin-right = 8
ebook:
margin: [1, 2, 3, 4] # margin-top=1, margin-right=2, margin-bottom=3, margin-left=4
For example:
ebook:
title: My EBook
base-font-size: 8
margin: 72
Right now you can output ebook in format of ePub
, mobi
, pdf
, html
.
To configure ePub
output, simply add epub
after ebook
.
---
ebook:
epub:
no-default-epub-cover: true
pretty-print: true
---
the following options are provided:
[true/false]
[true/false]
[true/false]
To configure pdf
output, simply add pdf
after ebook
.
ebook:
pdf:
paper-size: letter
default-font-size: 12
header-template: "<span> Written by shd101wyy _PAGENUM_ </span>"
the following options are provided:
a0
, a1
, a2
, a3
, a4
, a5
, a6
, b0
, b1
, b2
, b3
, b4
, b5
, b6
, legal
, letter
[number]
_PAGENUM_
, _TITLE_
, _AUTHOR_
and _SECTION_
will be replaced by their current values._PAGENUM_
, _TITLE_
, _AUTHOR_
and _SECTION_
will be replaced by their current values.[true/false]
default: false
[true/false]
Exporting .html
doesn't depend on ebook-convert
.
If you are exporting .html
file, then all local images will be included as base64
data inside a single html
file.
To configure html
output, simply add html
after ebook
.
ebook:
html:
cdn: true
cdn.js
. This option is only used when exporting .html
file.If there are ebook-convert
features you want to use that lack equivalents in the YAML options described above you can still use them by passing custom args
. For example:
---
ebook:
title: My EBook
args: ["--embed-all-fonts", "--embed-font-family"]
---
You can find a list of arguments in ebook-convert manual.
Summary.md
is a sample entry file. It should also have a TOC to help organize the book:
---
ebook:
title: Markdown Preview Enhanced
author: shd101wyy
---
# Preface
This is the preface, but not necessary.
# Table of Contents
* [Chapter 1](/chapter1/README.md)
* [Introduction of Markdown Preview Enhanced](/chapter1/intro.md)
* [Features](/chapter1/feature.md)
* [Chapter 2](/chapter2/README.md)
* [Known issues](/chapter2/issues.md)
The link's title is used as the chapter's title, and the link's target is a path to that chapter's file.
To export ebook, open the SUMMARY.md
with the preview opened. Then right click at the preview, choose Export to Disk
, then choose EBOOK
option. You can then export your ebook.
mermaid
, PlantUML
, etc will not work in the ebook generated. Only viz
works.此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。