Closed MurakamiShinyu closed 1 year ago
would definitely love this to be easy. currently, your method of putting top.css
with background-image
& referencing it from vivliostyle.config.js
works.
@import 'themes/packages/@vivliostyle/theme-gutenberg/theme_common.css';
@page :first {
background-image: url(cover.png);
}
h1 {
color: white;
}
module.exports = {
.
.
.
theme: '@vivliostyle/theme-gutenberg', // .css or local dir or npm package. default to undefined.
entry: [
{
rel: 'contents',
theme: 'top.css',
},
'./chapter1/index.md', // `title` is automatically guessed from the file (frontmatter > first heading).
'./chapter2/index.md',
'./chapter3/index.md',
'./chapter4/index.md',
'./chapter5/index.md',
// {
// path: 'epigraph.md',
// title: 'Epigraph', // title can be overwritten (entry > file),
// theme: '@vivliostyle/theme-whatever', // theme can be set individually. default to the root `theme`.
// },
// 'glossary.html', // html can be passed.
], // `entry` can be `string` or `object` if there's only single markdown file.
.
.
.
}
but would love a 1-config solution.
現在のCLI v3.0.0-pre版の config ファイルではcover画像を指定できるようになっている:
https://github.com/vivliostyle/vivliostyle-cli/blob/bcb002d81091b7892749457352b19485f12dc4a5/src/config.ts#L62
そこで指定された cover 画像は、出力されるmanifestファイルにcover画像へのリンクとして反映されるが、組版結果に出力されるようにはなっていない。 各出力形式(PDF, webbook, EPUB)の先頭ページとしてその画像が出力されてほしい。
一般的なEPUBの中身のファイル構成では、先頭のXHTML文書が表紙を表すもの("cover.xhtml" などのファイル名)で、その内容はたいてい表紙画像を表示するだけのものになっている。 たとえば、 https://github.com/IDPF/epub3-samples に公開されているEPUB3のサンプルでの例:
Vivliostyle Viewerでの表示の例:
このような単純な cover.html (EPUBでは cover.xhtml) ファイルを自動生成して、publication manifest の readingOrder (EPUBではOPFのspine要素)の最初の項目にするという機能があればよいだろう。page margin を0にして画像をページ一杯にするようなスタイルシートも自動でつくとよいかもしれない(そうすると上のVivliostyle Viewerでの表示の例の2番目のもののようにできる)。