Environment of create a book with Vivliostyle.js and vivliostyle-savepdf.
git clone https://github.com/akabekobeko/env-create-book
cd env-create-book
npm i
Run npm run build
to build a PDF with Vivliostyle.js and vivliostyle-savepdf. The built PDF will be output as output.pdf
in the project root directory.
Execute npm start
for the mode of HTML/CSS conversion automatically when Markdown/SCSS change is detected, and preview. Press Ctrl + C to abort.
To run watch and preview separately, use npm run watch
and npm run preview
.
Start writing by putting index.md
in the src/content
directory. Define the page metadata at the top of the Markdown.
---
title: 'My Book'
author: ['Author']
type: 'toc'
---
# Create Book
Cover page
- [Sample](page.html)
- [Sample 2](sub/sample.html)
Other pages are not limited except metadata YAML.
---
title: 'My Page'
author: ['Author']
type: 'page'
---
# My Page
A very interesting sentence.
The metadata at the top of the page is in YAML format. Currently supports the following:
Property | Type | Value |
---|---|---|
title |
string |
Title of page. When converted to HTML, it is specified in the <title> element. |
author |
string[] |
Author of page. It is used for page index etc. |
type |
string |
Type of page. toc can be specified only in index.md , which means that it has (generates) multiple pages and their indexes. If specified otherwise, it is set to the class attribute of the <body> element. e.g. <body class="type"> . |
To add a page other than the cover page, do the following:
- Define
type: 'toc'
in page metadata - Define links of other pages in
ul
andli
elements