JavaScript API
Exported members
Functions
Interfaces
Type Aliases
Variables
Functions
build()
build(
options):Promise<void>
Build publication file(s) from the given configuration.
import { build } from '@vivliostyle/cli';
build({
configPath: './vivliostyle.config.js',
logLevel: 'silent',
});
Parameters
options
author?
string = ...
bleed?
string = ...
browser?
string = ...
cmyk?
boolean | { mapOutput?: string; overrideMap?: [{ b: number; g: number; r: number; }, { c: number; k: number; m: number; y: number; }][]; warnUnmapped?: boolean; } = CmykSchema
config?
string = ...
configData?
VivliostyleConfigSchema | null = ...
createConfigFileOnly?
boolean = ...
cropMarks?
boolean = ...
cropOffset?
string = ...
css?
string = ...
cwd?
string = ...
disableServerStartup?
boolean = ...
enableStaticServe?
boolean = ...
enableViewerStartPage?
boolean = ...
executableBrowser?
string = ...
host?
string | boolean = ...
ignoreHttpsErrors?
boolean = ...
image?
string = ...
input?
string = ...
language?
string = ...
logger?
LoggerInterface = ...
logLevel?
"info" | "silent" | "verbose" | "debug" = ...
openViewer?
boolean = ...
output?
string | object & object | (string | object & object)[] = ...
port?
number = ...
preflight?
"press-ready" | "press-ready-local" = ...
preflightOption?
string | string[] = ...
pressReady?
boolean = ...
projectPath?
string = ...
proxyBypass?
string = ...
proxyPass?
string = ...
proxyServer?
string = ...
proxyUser?
string = ...
quick?
boolean = ...
readingProgression?
"ltr" | "rtl" = ...
renderMode?
"local" | "docker" = ...
sandbox?
boolean = ...
signal?
AbortSignal = ...
singleDoc?
boolean = ...
size?
string = ...
stderr?
Writable = ...
stdin?
Readable = ...
stdout?
Writable = ...
style?
string = ...
template?
string = ...
theme?
string | object & object | (string | object & object)[] = ...
timeout?
number = ...
title?
string = ...
userStyle?
string = ...
viewer?
string = ...
viewerParam?
string = ...
vite?
UserConfig = ...
viteConfigFile?
string | boolean = ...
Returns
Promise<void>
create()
create(
options):Promise<void>
Scaffold a new Vivliostyle project.
Parameters
options
author?
string = ...
bleed?
string = ...
browser?
string = ...
cmyk?
boolean | { mapOutput?: string; overrideMap?: [{ b: number; g: number; r: number; }, { c: number; k: number; m: number; y: number; }][]; warnUnmapped?: boolean; } = CmykSchema
config?
string = ...
configData?
VivliostyleConfigSchema | null = ...
createConfigFileOnly?
boolean = ...
cropMarks?
boolean = ...
cropOffset?
string = ...
css?
string = ...
cwd?
string = ...
disableServerStartup?
boolean = ...
enableStaticServe?
boolean = ...
enableViewerStartPage?
boolean = ...
executableBrowser?
string = ...
host?
string | boolean = ...
ignoreHttpsErrors?
boolean = ...
image?
string = ...
input?
string = ...
language?
string = ...
logger?
LoggerInterface = ...
logLevel?
"info" | "silent" | "verbose" | "debug" = ...
openViewer?
boolean = ...
output?
string | object & object | (string | object & object)[] = ...
port?
number = ...
preflight?
"press-ready" | "press-ready-local" = ...
preflightOption?
string | string[] = ...
pressReady?
boolean = ...
projectPath?
string = ...
proxyBypass?
string = ...
proxyPass?
string = ...
proxyServer?
string = ...
proxyUser?
string = ...
quick?
boolean = ...
readingProgression?
"ltr" | "rtl" = ...
renderMode?
"local" | "docker" = ...
sandbox?
boolean = ...
signal?
AbortSignal = ...
singleDoc?
boolean = ...
size?
string = ...
stderr?
Writable = ...
stdin?
Readable = ...
stdout?
Writable = ...
style?
string = ...
template?
string = ...
theme?
string | object & object | (string | object & object)[] = ...
timeout?
number = ...
title?
string = ...
userStyle?
string = ...
viewer?
string = ...
viewerParam?
string = ...
vite?
UserConfig = ...
viteConfigFile?
string | boolean = ...
Returns
Promise<void>
createVitePlugin()
createVitePlugin(
inlineConfig):Promise<Plugin<any>[]>
Parameters
inlineConfig
author?
string = ...
bleed?
string = ...
browser?
string = ...
cmyk?
boolean | { mapOutput?: string; overrideMap?: [{ b: number; g: number; r: number; }, { c: number; k: number; m: number; y: number; }][]; warnUnmapped?: boolean; } = CmykSchema
config?
string = ...
configData?
VivliostyleConfigSchema | null = ...
createConfigFileOnly?
boolean = ...
cropMarks?
boolean = ...
cropOffset?
string = ...
css?
string = ...
cwd?
string = ...
disableServerStartup?
boolean = ...
enableStaticServe?
boolean = ...
enableViewerStartPage?
boolean = ...
executableBrowser?
string = ...
host?
string | boolean = ...
ignoreHttpsErrors?
boolean = ...
image?
string = ...
input?
string = ...
language?
string = ...
logger?
LoggerInterface = ...
logLevel?
"info" | "silent" | "verbose" | "debug" = ...
openViewer?
boolean = ...
output?
string | object & object | (string | object & object)[] = ...
port?
number = ...
preflight?
"press-ready" | "press-ready-local" = ...
preflightOption?
string | string[] = ...
pressReady?
boolean = ...
projectPath?
string = ...
proxyBypass?
string = ...
proxyPass?
string = ...
proxyServer?
string = ...
proxyUser?
string = ...
quick?
boolean = ...
readingProgression?
"ltr" | "rtl" = ...
renderMode?
"local" | "docker" = ...
sandbox?
boolean = ...
signal?
AbortSignal = ...
singleDoc?
boolean = ...
size?
string = ...
stderr?
Writable = ...
stdin?
Readable = ...
stdout?
Writable = ...
style?
string = ...
template?
string = ...
theme?
string | object & object | (string | object & object)[] = ...
timeout?
number = ...
title?
string = ...
userStyle?
string = ...
viewer?
string = ...
viewerParam?
string = ...
vite?
UserConfig = ...
viteConfigFile?
string | boolean = ...
Returns
Promise<Plugin<any>[]>
defineConfig()
defineConfig(
config):VivliostyleConfigSchema
Define the configuration for Vivliostyle CLI.
Parameters
config
Returns
preview()
preview(
options):Promise<ViteDevServer>
Open a browser for previewing the publication.
Parameters
options
author?
string = ...
bleed?
string = ...
browser?
string = ...
cmyk?
boolean | { mapOutput?: string; overrideMap?: [{ b: number; g: number; r: number; }, { c: number; k: number; m: number; y: number; }][]; warnUnmapped?: boolean; } = CmykSchema
config?
string = ...
configData?
VivliostyleConfigSchema | null = ...
createConfigFileOnly?
boolean = ...
cropMarks?
boolean = ...
cropOffset?
string = ...
css?
string = ...
cwd?
string = ...
disableServerStartup?
boolean = ...
enableStaticServe?
boolean = ...
enableViewerStartPage?
boolean = ...
executableBrowser?
string = ...
host?
string | boolean = ...
ignoreHttpsErrors?
boolean = ...
image?
string = ...
input?
string = ...
language?
string = ...
logger?
LoggerInterface = ...
logLevel?
"info" | "silent" | "verbose" | "debug" = ...
openViewer?
boolean = ...
output?
string | object & object | (string | object & object)[] = ...
port?
number = ...
preflight?
"press-ready" | "press-ready-local" = ...
preflightOption?
string | string[] = ...
pressReady?
boolean = ...
projectPath?
string = ...
proxyBypass?
string = ...
proxyPass?
string = ...
proxyServer?
string = ...
proxyUser?
string = ...
quick?
boolean = ...
readingProgression?
"ltr" | "rtl" = ...
renderMode?
"local" | "docker" = ...
sandbox?
boolean = ...
signal?
AbortSignal = ...
singleDoc?
boolean = ...
size?
string = ...
stderr?
Writable = ...
stdin?
Readable = ...
stdout?
Writable = ...
style?
string = ...
template?
string = ...
theme?
string | object & object | (string | object & object)[] = ...
timeout?
number = ...
title?
string = ...
userStyle?
string = ...
viewer?
string = ...
viewerParam?
string = ...
vite?
UserConfig = ...
viteConfigFile?
string | boolean = ...
Returns
Promise<ViteDevServer>
VFM()
VFM(
options?,metadata?):Processor
Create Unified processor for Markdown AST and Hypertext AST.
Parameters
options?
Options.
metadata?
Returns
Processor
Unified processor.
Interfaces
StringifyMarkdownOptions
Option for convert Markdown to a stringify (HTML).
Properties
TemplateVariable
Extends
Omit<ParsedVivliostyleInlineConfig,"theme">
Properties
| Property | Type |
|---|---|
author |
string |
bleed? |
string |
browser? |
object |
browser.tag? |
string |
browser.type |
"chrome" | "chromium" | "firefox" |
cliVersion |
string |
cmyk? |
boolean | { mapOutput?: string; overrideMap?: [{ b: number; g: number; r: number; }, { c: number; k: number; m: number; y: number; }][]; warnUnmapped?: boolean; } |
config? |
string |
configData? |
VivliostyleConfigSchema | null |
coreVersion |
string |
createConfigFileOnly? |
boolean |
cropMarks? |
boolean |
cropOffset? |
string |
css? |
string |
cwd? |
string |
disableServerStartup? |
boolean |
enableStaticServe? |
boolean |
enableViewerStartPage? |
boolean |
executableBrowser? |
string |
host? |
string | boolean |
ignoreHttpsErrors? |
boolean |
image? |
string |
input? |
object |
input.entry |
string |
input.format |
InputFormat |
language |
string |
logger? |
LoggerInterface |
logLevel? |
"info" | "silent" | "verbose" | "debug" |
openViewer? |
boolean |
output? |
object & object & object[] |
port? |
number |
preflight? |
"press-ready" | "press-ready-local" |
preflightOption? |
string[] |
pressReady? |
boolean |
projectPath |
string |
proxyBypass? |
string |
proxyPass? |
string |
proxyServer? |
string |
proxyUser? |
string |
quick? |
boolean |
readingProgression? |
"ltr" | "rtl" |
renderMode? |
"local" | "docker" |
sandbox? |
boolean |
signal? |
AbortSignal |
singleDoc? |
boolean |
size? |
string |
stderr? |
Writable |
stdin? |
Readable |
stdout? |
Writable |
style? |
string |
template? |
string |
theme? |
string | object & object | (string | object & object)[] |
themePackage? |
VivliostylePackageJson |
timeout? |
number |
title |
string |
userStyle? |
string |
viewer? |
string |
viewerParam? |
string |
vite? |
UserConfig |
viteConfigFile? |
string | boolean |
Type Aliases
Metadata
Metadata =
object
Metadata from Frontmatter.
Properties
base?
optionalbase:Attribute[]
Attributes of <base>.
body?
optionalbody:Attribute[]
Attributes of <body>.
class?
optionalclass:string
Value of <html class="...">.
custom?
optionalcustom:object
A set of key-value pairs that are specified in readMetadata not to be processed as <meta>.
The data types converted from Frontmatter's YAML are retained.
Use this if want to add custom metadata with a third party tool.
Index Signature
[key: string]: any
dir?
optionaldir:string
Value of <html dir="...">. e.g. ltr, rtl, auto.
head?
optionalhead:string
<head>...</head>, reserved for future use.
html?
optionalhtml:Attribute[]
Attributes of <html>.
The id, lang, dir, and class specified in the root take precedence over the value of this property.
id?
optionalid:string
Value of <html id="...">.
lang?
optionallang:string
Value of <html lang="...">.
link?
optionallink:Attribute[][]
Attribute collection of <link>.
meta?
optionalmeta:Attribute[][]
Attribute collection of <meta>.
script?
optionalscript:Attribute[][]
Attribute collection of <script>.
style?
optionalstyle:string
<style>...</style>, reserved for future use.
title?
optionaltitle:string
Value of <title>...</title>.
vfm?
optionalvfm:VFMSettings
VFM settings.
StructuredDocument
StructuredDocument =
object
See
https://github.com/vivliostyle/vivliostyle-cli/blob/main/docs/config.md
Properties
children
children:
StructuredDocument[]
href
href:
string
sections?
optionalsections:StructuredDocumentSection[]
title
title:
string
StructuredDocumentSection
StructuredDocumentSection =
object
See
https://github.com/vivliostyle/vivliostyle-cli/blob/main/docs/config.md
Properties
children
children:
StructuredDocumentSection[]
headingHtml
headingHtml:
string
headingText
headingText:
string
href?
optionalhref:string
id?
optionalid:string
level
level:
number
VivliostyleConfigSchema
VivliostyleConfigSchema =
BuildTask[] |BuildTask
See
https://github.com/vivliostyle/vivliostyle-cli/blob/main/docs/config.md
VivliostylePackageMetadata
VivliostylePackageMetadata =
SchemaWithPipe<readonly [Omit<ObjectSchema<{template:SchemaWithPipe<readonly [RecordSchema<SchemaWithPipe<readonly [..., ..., ...]>,ObjectSchema<{description: ...;name: ...;prompt: ...;source: ...; },undefined>,undefined>,TitleAction<{[key:string]:object; },"VivliostyleTemplateMetadata">]>;theme:SchemaWithPipe<readonly [ObjectSchema<{author:SchemaWithPipe<...>;category:SchemaWithPipe<...>;name:SchemaWithPipe<...>;style:SchemaWithPipe<...>;topics:SchemaWithPipe<...>; },undefined>,TitleAction<{author?: ... | ...;category?: ... | ...;name?: ... | ...;style?: ... | ...;topics?: ... | ...; },"VivliostyleThemeMetadata">]>; },undefined>,"entries"|"~types"|"~run"|"~standard"> &object,TitleAction<{template?: {[key:string]:object; };theme?: {author?:string;category?:string;name?:string;style?:string;topics?:string[]; }; },"VivliostylePackageMetadata">]>
VivliostylePackageMetadata
VivliostylePackageMetadata =
v.InferInput<typeofVivliostylePackageMetadata>
Variables
readMetadata()
constreadMetadata: (md,customKeys?) =>Metadata
Read metadata from Markdown frontmatter.
Keys that are not defined as VFM are treated as meta. If you specify a key name in customKeys, the key and its data type will be preserved and stored in custom instead of meta.
Parameters
md
string
Markdown.
customKeys?
string[]
A collection of key names to be ignored by meta processing.
Returns
Metadata.