日本語|English

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 = ...

category?

"novel" | "magazine" | "journal" | "report" | "misc" = ...

cmyk?

boolean | { fallback?: CmykConversion | CmykConvertFunction; ifIncompatibleImagesFound?: "warn" | "error" | "ignore"; ifUnmappedColorsFound?: "warn" | "error" | "ignore"; mapOutput?: string; overrideMap?: [string | { b: number; g: number; r: number; }, { c: number; k: number; m: number; y: number; }][]; reserveMap?: [string | { 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 = ...

description?

string = ...

disableServerStartup?

boolean = ...

enableStaticServe?

boolean = ...

enableViewerStartPage?

boolean = ...

executableBrowser?

string = ...

host?

string | boolean = ...

ignoreHttpsErrors?

boolean = ...

image?

string = ...

input?

string = ...

installDependencies?

boolean = ...

language?

string = ...

license?

string = ...

logger?

LoggerInterface = ...

logLevel?

"silent" | "info" | "verbose" | "debug" = ...

name?

string = ...

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 | false | object & object | (string | object & object)[] = ...

themePath?

string = ...

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 = ...

category?

"novel" | "magazine" | "journal" | "report" | "misc" = ...

cmyk?

boolean | { fallback?: CmykConversion | CmykConvertFunction; ifIncompatibleImagesFound?: "warn" | "error" | "ignore"; ifUnmappedColorsFound?: "warn" | "error" | "ignore"; mapOutput?: string; overrideMap?: [string | { b: number; g: number; r: number; }, { c: number; k: number; m: number; y: number; }][]; reserveMap?: [string | { 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 = ...

description?

string = ...

disableServerStartup?

boolean = ...

enableStaticServe?

boolean = ...

enableViewerStartPage?

boolean = ...

executableBrowser?

string = ...

host?

string | boolean = ...

ignoreHttpsErrors?

boolean = ...

image?

string = ...

input?

string = ...

installDependencies?

boolean = ...

language?

string = ...

license?

string = ...

logger?

LoggerInterface = ...

logLevel?

"silent" | "info" | "verbose" | "debug" = ...

name?

string = ...

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 | false | object & object | (string | object & object)[] = ...

themePath?

string = ...

timeout?

number = ...

title?

string = ...

userStyle?

string = ...

viewer?

string = ...

viewerParam?

string = ...

vite?

UserConfig = ...

viteConfigFile?

string | boolean = ...

Returns

Promise<void>


createBuiltinCmykConversion()

createBuiltinCmykConversion(options?): CmykConversion

Creates a conversion for cmyk.fallback that converts RGB colors to CMYK using MuPDF's DeviceCMYK color space.

Parameters

options?

ColorConversionOptions = {}

Returns

CmykConversion


createBuiltinCmykConversionReplacement()

createBuiltinCmykConversionReplacement(options?): ImageConversionReplacement

Creates a replacement that converts images to DeviceCMYK.

Parameters

options?

ColorConversionOptions = {}

Returns

ImageConversionReplacement


createBuiltinGrayConversion()

createBuiltinGrayConversion(options?): CmykConversion

Creates a conversion for cmyk.fallback that converts RGB colors to grayscale and maps the result to the K channel.

Parameters

options?

ColorConversionOptions = {}

Returns

CmykConversion


createBuiltinGrayConversionReplacement()

createBuiltinGrayConversionReplacement(options?): ImageConversionReplacement

Creates a replacement that converts images to DeviceGray.

Parameters

options?

ColorConversionOptions = {}

Returns

ImageConversionReplacement


createBuiltinRgbConversionReplacement()

createBuiltinRgbConversionReplacement(options?): ImageConversionReplacement

Creates a replacement that converts images to DeviceRGB.

Parameters

options?

ColorConversionOptions = {}

Returns

ImageConversionReplacement


createIccConversion()

createIccConversion(options): CmykConversion

Creates a conversion for cmyk.fallback that converts RGB colors through an ICC profile. CMYK profiles return all four channels; grayscale profiles map to the K channel.

Parameters

options

IccConversionOptions

Returns

CmykConversion


createIccConversionReplacement()

createIccConversionReplacement(options): ImageConversionReplacement

Creates a replacement that converts images using a destination ICC profile and returns an image in the corresponding Device color space.

Parameters

options

IccConversionOptions

Returns

ImageConversionReplacement


createTheme()

createTheme(options): Promise<void>

Scaffold a new Vivliostyle theme package.

Parameters

options
author?

string = ...

bleed?

string = ...

browser?

string = ...

category?

"novel" | "magazine" | "journal" | "report" | "misc" = ...

cmyk?

boolean | { fallback?: CmykConversion | CmykConvertFunction; ifIncompatibleImagesFound?: "warn" | "error" | "ignore"; ifUnmappedColorsFound?: "warn" | "error" | "ignore"; mapOutput?: string; overrideMap?: [string | { b: number; g: number; r: number; }, { c: number; k: number; m: number; y: number; }][]; reserveMap?: [string | { 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 = ...

description?

string = ...

disableServerStartup?

boolean = ...

enableStaticServe?

boolean = ...

enableViewerStartPage?

boolean = ...

executableBrowser?

string = ...

host?

string | boolean = ...

ignoreHttpsErrors?

boolean = ...

image?

string = ...

input?

string = ...

installDependencies?

boolean = ...

language?

string = ...

license?

string = ...

logger?

LoggerInterface = ...

logLevel?

"silent" | "info" | "verbose" | "debug" = ...

name?

string = ...

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 | false | object & object | (string | object & object)[] = ...

themePath?

string = ...

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 = ...

category?

"novel" | "magazine" | "journal" | "report" | "misc" = ...

cmyk?

boolean | { fallback?: CmykConversion | CmykConvertFunction; ifIncompatibleImagesFound?: "warn" | "error" | "ignore"; ifUnmappedColorsFound?: "warn" | "error" | "ignore"; mapOutput?: string; overrideMap?: [string | { b: number; g: number; r: number; }, { c: number; k: number; m: number; y: number; }][]; reserveMap?: [string | { 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 = ...

description?

string = ...

disableServerStartup?

boolean = ...

enableStaticServe?

boolean = ...

enableViewerStartPage?

boolean = ...

executableBrowser?

string = ...

host?

string | boolean = ...

ignoreHttpsErrors?

boolean = ...

image?

string = ...

input?

string = ...

installDependencies?

boolean = ...

language?

string = ...

license?

string = ...

logger?

LoggerInterface = ...

logLevel?

"silent" | "info" | "verbose" | "debug" = ...

name?

string = ...

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 | false | object & object | (string | object & object)[] = ...

themePath?

string = ...

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

VivliostyleConfigSchema

Returns

VivliostyleConfigSchema


preview()

preview(options): Promise<ViteDevServer>

Open a browser for previewing the publication.

Parameters

options
author?

string = ...

bleed?

string = ...

browser?

string = ...

category?

"novel" | "magazine" | "journal" | "report" | "misc" = ...

cmyk?

boolean | { fallback?: CmykConversion | CmykConvertFunction; ifIncompatibleImagesFound?: "warn" | "error" | "ignore"; ifUnmappedColorsFound?: "warn" | "error" | "ignore"; mapOutput?: string; overrideMap?: [string | { b: number; g: number; r: number; }, { c: number; k: number; m: number; y: number; }][]; reserveMap?: [string | { 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 = ...

description?

string = ...

disableServerStartup?

boolean = ...

enableStaticServe?

boolean = ...

enableViewerStartPage?

boolean = ...

executableBrowser?

string = ...

host?

string | boolean = ...

ignoreHttpsErrors?

boolean = ...

image?

string = ...

input?

string = ...

installDependencies?

boolean = ...

language?

string = ...

license?

string = ...

logger?

LoggerInterface = ...

logLevel?

"silent" | "info" | "verbose" | "debug" = ...

name?

string = ...

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 | false | object & object | (string | object & object)[] = ...

themePath?

string = ...

timeout?

number = ...

title?

string = ...

userStyle?

string = ...

viewer?

string = ...

viewerParam?

string = ...

vite?

UserConfig = ...

viteConfigFile?

string | boolean = ...

Returns

Promise<ViteDevServer>


validateTheme()

validateTheme(options): Promise<ThemeValidationResult[]>

Validate a Vivliostyle theme package.

Parameters

options
author?

string = ...

bleed?

string = ...

browser?

string = ...

category?

"novel" | "magazine" | "journal" | "report" | "misc" = ...

cmyk?

boolean | { fallback?: CmykConversion | CmykConvertFunction; ifIncompatibleImagesFound?: "warn" | "error" | "ignore"; ifUnmappedColorsFound?: "warn" | "error" | "ignore"; mapOutput?: string; overrideMap?: [string | { b: number; g: number; r: number; }, { c: number; k: number; m: number; y: number; }][]; reserveMap?: [string | { 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 = ...

description?

string = ...

disableServerStartup?

boolean = ...

enableStaticServe?

boolean = ...

enableViewerStartPage?

boolean = ...

executableBrowser?

string = ...

host?

string | boolean = ...

ignoreHttpsErrors?

boolean = ...

image?

string = ...

input?

string = ...

installDependencies?

boolean = ...

language?

string = ...

license?

string = ...

logger?

LoggerInterface = ...

logLevel?

"silent" | "info" | "verbose" | "debug" = ...

name?

string = ...

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 | false | object & object | (string | object & object)[] = ...

themePath?

string = ...

timeout?

number = ...

title?

string = ...

userStyle?

string = ...

viewer?

string = ...

viewerParam?

string = ...

vite?

UserConfig = ...

viteConfigFile?

string | boolean = ...

Returns

Promise<ThemeValidationResult[]>

Validation results. The package is valid if no result has the type error.


VFM()

VFM(options?, metadata?): Processor

Create Unified processor for Markdown AST and Hypertext AST.

Parameters

options?

StringifyMarkdownOptions

Options.

metadata?

Metadata

Returns

Processor

Unified processor.

Interfaces

CMYKValue

Properties

Property Type
c number
k number
m number
y number

ColorConversionOptions

Options shared by color conversions and image conversion replacements.

Extended by

Properties

Property Type Description
inputProfile? string Path to an ICC profile used to interpret an unprofiled DeviceGray, DeviceRGB, or DeviceCMYK input. It must use the same color space as the input. For cmyk.fallback, the input is always RGB. Relative paths use the same entry context as replaceImage source and replacement paths.

IccConversionOptions

Options for conversion using a caller-provided destination ICC profile.

Extends

Properties

Property Type Description
inputProfile? string Path to an ICC profile used to interpret an unprofiled DeviceGray, DeviceRGB, or DeviceCMYK input. It must use the same color space as the input. For cmyk.fallback, the input is always RGB. Relative paths use the same entry context as replaceImage source and replacement paths.
outputProfile string Path to the destination ICC profile. Relative paths use the same entry context as replaceImage source and replacement paths. The converted image uses the corresponding Device color space; the profile itself is not embedded in the image. For cmyk.fallback, the profile must use CMYK or Gray; Gray is mapped to the K channel.

ReplaceFunctionContext

Values available while a replacement function is running.

Properties

Property Type Description
image Image The current PDF image as an owned reference scoped to this invocation. Its ownership is moved into the replacement function and Vivliostyle CLI destroys it when the function settles unless it is returned as the replacement. It must not be destroyed manually or retained after the function settles. Native objects returned by its methods are owned by the replacement function and must be destroyed before it settles unless that object is an image returned as the replacement.
mupdf __module The MuPDF module that owns the current image.

StringifyMarkdownOptions

Option for convert Markdown to a stringify (HTML).

Declared as interface so that downstream consumers (e.g. vivliostyle-cli) see a stable nominal name instead of v.InferInput<typeof StringifyMarkdownOptionsSchema>. The latter form causes TypeScript to expand the schema's structural shape during declaration emit and pulls non-portable .pnpm/... paths through pnpm isolated installs (TS2742). The compile-time check below pins this interface to the schema, so a drift in either direction is rejected.

Extends

  • InferInput<typeof _stringifyMarkdownOptionsSchema>

Properties

Property Type
assignIdToFigcaption? boolean
captionlessImagePolicy? "paragraph" | "figure" | "figure-with-figcaption"
disableFormatHtml? boolean
editPlugins? EditPlugins
footnote? "pandoc" | "dpub" | "gcpm" | { mode: "pandoc"; } | { body?: Properties | DpubBodyFactory; call?: Properties | DpubCallFactory; mode: "dpub"; } | { body?: Properties | GcpmBodyFactory; duplicatedCall?: Properties | GcpmDuplicatedCallFactory; mode: "gcpm"; }
hardLineBreaks? boolean
imgFigcaptionOrder? "img-figcaption" | "figcaption-img"
language? string
math? boolean
mathRenderer? "mathjax" | "mathml"
parseFigcaptionAsInline? boolean
partial? boolean
replace? ReplaceRule[]
rewriteRelativeHrefExtensions? boolean | readonly string[]
style? string | string[]
table? object
table.cell? "align-attribute" | "align-class" | "align-style" | TableCellHook
title? string

TemplateVariable

Extends

  • Omit<ParsedVivliostyleInlineConfig, "theme">

Properties

Property Type
author string
bleed? string
browser? object
browser.tag? string
browser.type "chrome" | "chromium" | "firefox"
category? "novel" | "magazine" | "journal" | "report" | "misc"
cliVersion string
cmyk? boolean | { fallback?: CmykConversion | CmykConvertFunction; ifIncompatibleImagesFound?: "warn" | "error" | "ignore"; ifUnmappedColorsFound?: "warn" | "error" | "ignore"; mapOutput?: string; overrideMap?: [string | { b: number; g: number; r: number; }, { c: number; k: number; m: number; y: number; }][]; reserveMap?: [string | { 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
description? string
disableServerStartup? boolean
enableStaticServe? boolean
enableViewerStartPage? boolean
executableBrowser? string
host? string | boolean
ignoreHttpsErrors? boolean
image? string
input? object
input.entry string
input.format InputFormat
installDependencies? boolean
language string
license? string
logger? LoggerInterface
logLevel? "silent" | "info" | "verbose" | "debug"
name? string
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
themePath? string
timeout? number
title string
userStyle? string
viewer? string
viewerParam? string
vite? UserConfig
viteConfigFile? string | boolean

ThemeTemplateVariable

Extends

  • ParsedVivliostyleInlineConfig

Properties

Property Type
author string
bleed? string
browser? object
browser.tag? string
browser.type "chrome" | "chromium" | "firefox"
category "novel" | "magazine" | "journal" | "report" | "misc"
cliVersion string
cmyk? boolean | { fallback?: CmykConversion | CmykConvertFunction; ifIncompatibleImagesFound?: "warn" | "error" | "ignore"; ifUnmappedColorsFound?: "warn" | "error" | "ignore"; mapOutput?: string; overrideMap?: [string | { b: number; g: number; r: number; }, { c: number; k: number; m: number; y: number; }][]; reserveMap?: [string | { 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
description string
disableServerStartup? boolean
enableStaticServe? boolean
enableViewerStartPage? boolean
executableBrowser? string
host? string | boolean
ignoreHttpsErrors? boolean
image? string
input? object
input.entry string
input.format InputFormat
installDependencies boolean
language? string
license string
logger? LoggerInterface
logLevel? "silent" | "info" | "verbose" | "debug"
name string
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? false | object & object[]
themeName string
themePath? string
timeout? number
title? string
userStyle? string
viewer? string
viewerParam? string
vite? UserConfig
viteConfigFile? string | boolean

ThemeValidationResult

Properties

Property Type
message string
type "error" | "warning"

Type Aliases

CmykConversion

CmykConversion = Readonly<v.InferInput<typeof CmykConversionSchema>>


CmykConvertFunction

CmykConvertFunction = (rgb) => CMYKValue | null | Promise<CMYKValue | null>

Converts an unmapped RGB color on a 0-10000 scale to CMYK, or returns null to leave it unmapped.

Parameters

rgb
b

number

g

number

r

number

Returns

CMYKValue | null | Promise<CMYKValue | null>


ImageConversionReplacement

ImageConversionReplacement = Readonly<v.InferInput<typeof ImageConversionReplacementSchema>>


Metadata

Metadata = object

Metadata from Frontmatter.

Properties

base?

optional base?: Attribute[]

Attributes of <base>.

body?

optional body?: Attribute[]

Attributes of <body>.

class?

optional class?: string

Value of <html class="...">.

custom?

optional custom?: 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?

optional dir?: string

Value of <html dir="...">. e.g. ltr, rtl, auto.

optional head?: string

<head>...</head>, reserved for future use.

html?

optional html?: Attribute[]

Attributes of <html>. The id, lang, dir, and class specified in the root take precedence over the value of this property.

id?

optional id?: string

Value of <html id="...">.

lang?

optional lang?: string

Value of <html lang="...">.

optional link?: Attribute[][]

Attribute collection of <link>.

meta?

optional meta?: Attribute[][]

Attribute collection of <meta>.

script?

optional script?: Attribute[][]

Attribute collection of <script>.

style?

optional style?: string

<style>...</style>, reserved for future use.

title?

optional title?: string

Value of <title>...</title>.

vfm?

optional vfm?: VFMSettings

VFM settings.


ReplaceFunction

ReplaceFunction = (context) => mupdfType.Image | null | Promise<mupdfType.Image | null>

Returns an owned replacement image, transferring its ownership to Vivliostyle CLI, or null to decline the current match and continue to the next replacement candidate. The returned image must be created with the supplied mupdf module and must not be used or destroyed after it is returned. The current image may be returned directly to use it as the replacement.

Parameters

context

ReplaceFunctionContext

Returns

mupdfType.Image | null | Promise<mupdfType.Image | null>


StructuredDocument

StructuredDocument = object

See

https://github.com/vivliostyle/vivliostyle-cli/blob/main/docs/config.md

Properties

children

children: StructuredDocument[]

href

href: string

sections?

optional sections?: 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?

optional href?: string

id?

optional id?: string

level

level: number


TocCompose

TocCompose = ({ h }) => ({ heading, content, }) => ElementContent[]

Parameters

{ h }
h

h

Returns

({ heading, content, }) => ElementContent[]


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<typeof VivliostylePackageMetadata>

Variables

readMetadata

const readMetadata: (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

Metadata.