@vivliostyle/cli
Advanced tools
Comparing version 8.10.0 to 8.11.0
@@ -1,6 +0,7 @@ | ||
export { build, BuildCliFlags } from './build.js'; | ||
export { init, InitCliFlags } from './init.js'; | ||
export { preview, PreviewCliFlags } from './preview.js'; | ||
export { BuildCliFlags, build } from './build.js'; | ||
export { InitCliFlags, init } from './init.js'; | ||
export { PreviewCliFlags, preview } from './preview.js'; | ||
export type { PublicationManifest } from './schema/publication.schema.js'; | ||
export type { StructuredDocument, StructuredDocumentSection, } from './schema/vivliostyle.js'; | ||
export type { VivliostyleConfigSchema } from './schema/vivliostyleConfig.schema.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -41,3 +41,7 @@ import chalk from 'chalk'; | ||
// workspaceDir: '.vivliostyle', // directory which is saved intermediate files. | ||
// toc: true, // whether generate and include ToC HTML or not, default to 'false'. | ||
// toc: { | ||
// title: 'Table of Contents', | ||
// htmlPath: 'index.html', | ||
// sectionDepth: 3, | ||
// }, | ||
// cover: './cover.png', // cover image. default to undefined. | ||
@@ -44,0 +48,0 @@ // vfm: { // options of VFM processor |
import { InputFormat, ManuscriptMediaType } from '../input/input-types.js'; | ||
import { OutputFormat } from '../output/output-types.js'; | ||
import { StructuredDocument, StructuredDocumentSection } from '../schema/vivliostyle.js'; | ||
import type { BrowserType, ThemeObject, VivliostyleConfigEntry } from '../schema/vivliostyleConfig.schema.js'; | ||
@@ -34,6 +35,15 @@ import { PageSize } from '../server.js'; | ||
rel: 'contents'; | ||
title?: string; | ||
title: string; | ||
themes: ParsedTheme[]; | ||
source?: undefined; | ||
target: string; | ||
sectionDepth: number; | ||
transform: { | ||
transformDocumentList: ((nodeList: StructuredDocument[]) => (propsList: { | ||
children: any; | ||
}[]) => any) | undefined; | ||
transformSectionList: ((nodeList: StructuredDocumentSection[]) => (propsList: { | ||
children: any; | ||
}[]) => any) | undefined; | ||
}; | ||
pageBreakBefore?: 'left' | 'right' | 'recto' | 'verso'; | ||
@@ -169,3 +179,3 @@ pageCounterReset?: number; | ||
})>; | ||
export declare function mergeConfig<T extends CliFlags>(cliFlags: T, config: VivliostyleConfigEntry | undefined, context: string): Promise<MergedConfig>; | ||
export declare function mergeConfig<T extends CliFlags>(cliFlags: T, config: VivliostyleConfigEntry | undefined, context: string, prevConfig?: MergedConfig): Promise<MergedConfig>; | ||
//# sourceMappingURL=config.d.ts.map |
@@ -218,2 +218,5 @@ import chalk from 'chalk'; | ||
} | ||
if (configEntries.some((config) => config.tocTitle)) { | ||
logWarn(chalk.yellowBright("'tocTitle' property of Vivliostyle config was deprecated and will be removed in a future release. Please use 'toc.title' property instead.")); | ||
} | ||
return { | ||
@@ -224,3 +227,3 @@ cliFlags, | ||
} | ||
export async function mergeConfig(cliFlags, config, context) { | ||
export async function mergeConfig(cliFlags, config, context, prevConfig) { | ||
debug('context directory', context); | ||
@@ -456,8 +459,8 @@ debug('cliFlags', cliFlags); | ||
const parsedConfig = cliFlags.input | ||
? await composeSingleInputConfig(commonOpts, cliFlags, config) | ||
: await composeProjectConfig(commonOpts, cliFlags, config, context); | ||
? await composeSingleInputConfig(commonOpts, cliFlags, config, prevConfig) | ||
: await composeProjectConfig(commonOpts, cliFlags, config, context, prevConfig); | ||
debug('parsedConfig', JSON.stringify(parsedConfig, null, 2)); | ||
return parsedConfig; | ||
} | ||
async function composeSingleInputConfig(otherConfig, cliFlags, config) { | ||
async function composeSingleInputConfig(otherConfig, cliFlags, config, prevConfig) { | ||
debug('entering single entry config mode'); | ||
@@ -487,6 +490,16 @@ let sourcePath; | ||
const relDir = upath.relative(otherConfig.entryContextDir, upath.dirname(sourcePath)); | ||
const target = upath | ||
.resolve(workspaceDir, relDir, `${tmpPrefix}${upath.basename(sourcePath)}`) | ||
.replace(/\.md$/, '.html'); | ||
await touchTmpFile(target); | ||
let target; | ||
if (prevConfig) { | ||
const prevEntry = prevConfig.entries.find((e) => e.source === sourcePath); | ||
if (!prevEntry) { | ||
throw new Error('Failed to reload config'); | ||
} | ||
target = prevEntry.target; | ||
} | ||
else { | ||
target = upath | ||
.resolve(workspaceDir, relDir, `${tmpPrefix}${upath.basename(sourcePath)}`) | ||
.replace(/\.md$/, '.html'); | ||
await touchTmpFile(target); | ||
} | ||
const themes = metadata.themes ?? [...otherConfig.rootThemes]; | ||
@@ -560,3 +573,3 @@ themes.forEach((t) => otherConfig.themeIndexes.add(t)); | ||
} | ||
async function composeProjectConfig(otherConfig, cliFlags, config, context) { | ||
async function composeProjectConfig(otherConfig, cliFlags, config, context, prevConfig) { | ||
debug('entering project config mode'); | ||
@@ -571,3 +584,18 @@ const { entryContextDir, workspaceDir, themesDir, themeIndexes, rootThemes, outputs, cover, } = otherConfig; | ||
} | ||
const autoGeneratedTocPath = upath.resolve(workspaceDir, typeof config?.toc === 'string' ? config.toc : TOC_FILENAME); | ||
const tocConfig = (() => { | ||
const c = typeof config?.toc === 'object' | ||
? config.toc | ||
: typeof config?.toc === 'string' | ||
? { htmlPath: config.toc } | ||
: {}; | ||
return { | ||
title: c.title ?? config?.tocTitle ?? TOC_TITLE, | ||
target: upath.resolve(workspaceDir, c.htmlPath ?? TOC_FILENAME), | ||
sectionDepth: c.sectionDepth ?? 0, | ||
transform: { | ||
transformDocumentList: c.transformDocumentList, | ||
transformSectionList: c.transformSectionList, | ||
}, | ||
}; | ||
})(); | ||
const ensureCoverImage = (src) => { | ||
@@ -599,4 +627,4 @@ const absPath = src && upath.resolve(entryContextDir, src); | ||
rel: 'contents', | ||
target: autoGeneratedTocPath, | ||
title: entry.title ?? config?.tocTitle ?? TOC_TITLE, | ||
...tocConfig, | ||
title: entry.title ?? tocConfig.title, | ||
themes, | ||
@@ -687,4 +715,3 @@ pageBreakBefore: entry.pageBreakBefore, | ||
rel: 'contents', | ||
target: autoGeneratedTocPath, | ||
title: config?.tocTitle ?? TOC_TITLE, | ||
...tocConfig, | ||
themes: [...rootThemes], | ||
@@ -691,0 +718,0 @@ }); |
@@ -22,3 +22,3 @@ interface OutputFormatTrait<T extends string = string> { | ||
export declare const checkOutputFormat: (v: unknown) => v is "epub" | "pdf" | "webpub"; | ||
export declare const checkRenderMode: (v: unknown) => v is "local" | "docker"; | ||
export declare const checkRenderMode: (v: unknown) => v is "docker" | "local"; | ||
export declare const checkPreflightMode: (v: unknown) => v is "press-ready" | "press-ready-local" | null; | ||
@@ -25,0 +25,0 @@ export declare function detectOutputFormat(outputPath: string): OutputFormat['format']; |
@@ -150,2 +150,4 @@ import chokidar from 'chokidar'; | ||
const stopLogging = startLogging(`Rebuilding ${path}`); | ||
// update mergedConfig | ||
config = await mergeConfig(cliFlags, vivliostyleConfig?.[0], context, config); | ||
// build artifacts | ||
@@ -152,0 +154,0 @@ if (config.manifestPath) { |
import chalk from 'chalk'; | ||
import { lookup as mime } from 'mime-types'; | ||
import fs from 'node:fs'; | ||
import { TOC_TITLE } from '../const.js'; | ||
import { DetailError, assertPubManifestSchema, copy, debug, log, pathContains, pathEquals, remove, safeGlob, startLogging, upath, useTmpDirectory, } from '../util.js'; | ||
@@ -182,3 +181,3 @@ import { generateCoverHtml, generateTocHtml, isCovertHtml, isTocHtml, processManuscriptHtml, } from './html.js'; | ||
const stylesheets = entry.themes.flatMap((theme) => locateThemePath(theme, upath.dirname(entry.target))); | ||
const tocString = generateTocHtml({ | ||
const tocString = await generateTocHtml({ | ||
entries: contentEntries, | ||
@@ -189,5 +188,7 @@ manifestPath, | ||
title, | ||
tocTitle: entry.title ?? TOC_TITLE, | ||
tocTitle: entry.title, | ||
sectionDepth: entry.sectionDepth, | ||
stylesheets, | ||
styleOptions: entry, | ||
transform: entry.transform, | ||
}); | ||
@@ -194,0 +195,0 @@ fs.mkdirSync(upath.dirname(entry.target), { recursive: true }); |
/// <reference types="node" resolution-mode="require"/> | ||
import jsdom, { ResourceLoader as BaseResourceLoader, JSDOM } from '@vivliostyle/jsdom'; | ||
import { ManuscriptEntry } from '../input/config.js'; | ||
import DOMPurify from 'dompurify'; | ||
import type { ManuscriptEntry } from '../input/config.js'; | ||
import type { PublicationManifest } from '../schema/publication.schema.js'; | ||
import { StructuredDocument, StructuredDocumentSection } from '../schema/vivliostyle.js'; | ||
export declare const htmlPurify: DOMPurify.DOMPurifyI; | ||
export declare class ResourceLoader extends BaseResourceLoader { | ||
@@ -12,2 +15,3 @@ fetcherMap: Map<string, jsdom.AbortablePromise<Buffer>>; | ||
}>; | ||
export declare function getStructuredSectionFromHtml(htmlPath: string, href?: string): Promise<StructuredDocumentSection[]>; | ||
declare const getTocHtmlStyle: ({ pageBreakBefore, pageCounterReset, }: { | ||
@@ -17,3 +21,12 @@ pageBreakBefore?: "left" | "right" | "recto" | "verso" | undefined; | ||
}) => string | null; | ||
export declare function generateTocHtml({ entries, manifestPath, distDir, language, title, tocTitle, stylesheets, styleOptions, }: { | ||
type HastElement = import('hast').ElementContent | import('hast').Root; | ||
export declare const defaultTocTransform: { | ||
transformDocumentList: (nodeList: StructuredDocument[]) => (propsList: { | ||
children: HastElement | HastElement[]; | ||
}[]) => HastElement; | ||
transformSectionList: (nodeList: StructuredDocumentSection[]) => (propsList: { | ||
children: HastElement | HastElement[]; | ||
}[]) => HastElement; | ||
}; | ||
export declare function generateTocHtml({ entries, manifestPath, distDir, language, title, tocTitle, sectionDepth, stylesheets, styleOptions, transform, }: { | ||
entries: Pick<ManuscriptEntry, 'target' | 'title'>[]; | ||
@@ -25,5 +38,7 @@ manifestPath: string; | ||
tocTitle: string; | ||
sectionDepth: number; | ||
stylesheets?: string[]; | ||
styleOptions?: Parameters<typeof getTocHtmlStyle>[0]; | ||
}): string; | ||
transform?: Partial<typeof defaultTocTransform>; | ||
}): Promise<string>; | ||
declare const getCoverHtmlStyle: ({ pageBreakBefore, }: { | ||
@@ -30,0 +45,0 @@ pageBreakBefore?: "left" | "right" | "recto" | "verso" | undefined; |
@@ -0,6 +1,7 @@ | ||
import { jsx as _jsx, jsxs as _jsxs } from "hastscript/jsx-runtime"; | ||
import jsdom, { ResourceLoader as BaseResourceLoader, JSDOM, } from '@vivliostyle/jsdom'; | ||
import chalk from 'chalk'; | ||
import cheerio from 'cheerio'; | ||
import toHTML from 'hast-util-to-html'; | ||
import h from 'hastscript'; | ||
import DOMPurify from 'dompurify'; | ||
import { toHtml } from 'hast-util-to-html'; | ||
import fs from 'node:fs'; | ||
@@ -38,2 +39,3 @@ import { fileURLToPath, pathToFileURL } from 'node:url'; | ||
/* c8 ignore end */ | ||
export const htmlPurify = DOMPurify(new JSDOM('').window); | ||
export class ResourceLoader extends BaseResourceLoader { | ||
@@ -75,2 +77,43 @@ fetcherMap = new Map(); | ||
} | ||
export async function getStructuredSectionFromHtml(htmlPath, href) { | ||
const { dom } = await getJsdomFromUrlOrFile(htmlPath); | ||
const { document } = dom.window; | ||
const allHeadings = [...document.querySelectorAll('h1, h2, h3, h4, h5, h6')] | ||
.filter((el) => { | ||
// Exclude headings contained by blockquote | ||
// TODO: Make customizable | ||
return !el.matches('blockquote *'); | ||
}) | ||
.sort((a, b) => { | ||
const position = a.compareDocumentPosition(b); | ||
return position & 2 /* DOCUMENT_POSITION_PRECEDING */ | ||
? 1 | ||
: position & 4 /* DOCUMENT_POSITION_FOLLOWING */ | ||
? -1 | ||
: 0; | ||
}); | ||
function traverse(headers) { | ||
if (headers.length === 0) { | ||
return []; | ||
} | ||
const [head, ...tail] = headers; | ||
const section = head.parentElement; | ||
const id = head.id || section.id; | ||
const level = Number(head.tagName.slice(1)); | ||
let i = tail.findIndex((s) => Number(s.tagName.slice(1)) <= level); | ||
i = i === -1 ? tail.length : i; | ||
return [ | ||
{ | ||
headingHtml: htmlPurify.sanitize(head.innerHTML), | ||
headingText: head.textContent?.trim().replace(/\s+/g, ' ') || '', | ||
level, | ||
...(href && id && { href: `${href}#${encodeURIComponent(id)}` }), | ||
...(id && { id }), | ||
children: traverse(tail.slice(0, i)), | ||
}, | ||
...traverse(tail.slice(i)), | ||
]; | ||
} | ||
return traverse(allHeadings); | ||
} | ||
const getTocHtmlStyle = ({ pageBreakBefore, pageCounterReset, }) => { | ||
@@ -93,19 +136,71 @@ if (!pageBreakBefore && typeof pageCounterReset !== 'number') { | ||
}; | ||
export function generateTocHtml({ entries, manifestPath, distDir, language, title, tocTitle, stylesheets = [], styleOptions = {}, }) { | ||
const items = entries.map((entry) => h('li', h('a', { href: encodeURI(upath.relative(distDir, entry.target)) }, entry.title || upath.basename(entry.target, '.html')))); | ||
const toc = h('html', { lang: language }, h('head', ...[ | ||
h('meta', { charset: 'utf-8' }), | ||
h('title', title ?? ''), | ||
...(() => { | ||
const style = getTocHtmlStyle(styleOptions); | ||
return style ? [h('style', getTocHtmlStyle(styleOptions))] : []; | ||
})(), | ||
h('link', { | ||
href: encodeURI(upath.relative(distDir, manifestPath)), | ||
rel: 'publication', | ||
type: 'application/ld+json', | ||
}), | ||
...stylesheets.map((s) => h('link', { type: 'text/css', href: s, rel: 'stylesheet' })), | ||
].filter((n) => !!n)), h('body', h('h1', title || ''), h('nav#toc', { role: 'doc-toc' }, h('h2', tocTitle), h('ol', items)))); | ||
return prettier.format(toHTML(toc), { parser: 'html' }); | ||
export const defaultTocTransform = { | ||
transformDocumentList: (nodeList) => (propsList) => { | ||
return (_jsx("ol", { children: nodeList | ||
.map((a, i) => [a, propsList[i]]) | ||
.flatMap(([{ href, title, sections }, { children, ...otherProps }]) => { | ||
// don't display the document title if it has only one top-level H1 heading | ||
if (sections?.length === 1 && sections[0].level === 1) { | ||
return [children].flat().flatMap((e) => { | ||
if (e.type === 'element' && e.tagName === 'ol') { | ||
return e.children; | ||
} | ||
return e; | ||
}); | ||
} | ||
return (_jsxs("li", { ...otherProps, children: [_jsx("a", { ...{ href }, children: title }), children] })); | ||
}) })); | ||
}, | ||
transformSectionList: (nodeList) => (propsList) => { | ||
return (_jsx("ol", { children: nodeList | ||
.map((a, i) => [a, propsList[i]]) | ||
.map(([{ headingHtml, href, level }, { children, ...otherProps }]) => { | ||
const headingContent = { | ||
type: 'raw', | ||
value: headingHtml, | ||
}; | ||
return (_jsxs("li", { ...otherProps, "data-section-level": level, children: [href ? (_jsx("a", { ...{ href }, children: headingContent })) : (_jsx("span", { children: headingContent })), children] })); | ||
}) })); | ||
}, | ||
}; | ||
export async function generateTocHtml({ entries, manifestPath, distDir, language, title, tocTitle, sectionDepth, stylesheets = [], styleOptions = {}, transform = {}, }) { | ||
const { transformDocumentList = defaultTocTransform.transformDocumentList, transformSectionList = defaultTocTransform.transformSectionList, } = transform; | ||
const structure = await Promise.all(entries.map(async (entry) => { | ||
const href = encodeURI(upath.relative(distDir, entry.target)); | ||
const sections = sectionDepth >= 1 | ||
? await getStructuredSectionFromHtml(entry.target, href) | ||
: []; | ||
return { | ||
title: entry.title || upath.basename(entry.target, '.html'), | ||
href: encodeURI(upath.relative(distDir, entry.target)), | ||
sections, | ||
children: [], // TODO | ||
}; | ||
})); | ||
const docToc = transformDocumentList(structure)(structure.map((doc) => { | ||
function renderSectionList(sections) { | ||
const nodeList = sections.flatMap((section) => { | ||
if (section.level > sectionDepth) { | ||
return []; | ||
} | ||
return section; | ||
}); | ||
if (nodeList.length === 0) { | ||
return []; | ||
} | ||
return transformSectionList(nodeList)(nodeList.map((node) => ({ | ||
children: [renderSectionList(node.children || [])].flat(), | ||
}))); | ||
} | ||
return { | ||
children: [renderSectionList(doc.sections || [])].flat(), | ||
}; | ||
})); | ||
const toc = (_jsxs("html", { lang: language, children: [_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("title", { children: title || '' }), (() => { | ||
const style = getTocHtmlStyle(styleOptions); | ||
return style ? _jsx("style", { children: style }) : null; | ||
})(), _jsx("link", { href: encodeURI(upath.relative(distDir, manifestPath)), rel: "publication", type: "application/ld+json" }), stylesheets.map((s) => (_jsx("link", { type: "text/css", href: s, rel: "stylesheet" })))] }), _jsxs("body", { children: [_jsx("h1", { children: title || '' }), _jsxs("nav", { id: "toc", role: "doc-toc", children: [_jsx("h2", { children: tocTitle }), docToc] })] })] })); | ||
return prettier.format(toHtml(toc, { allowDangerousHtml: true }), { | ||
parser: 'html', | ||
}); | ||
} | ||
@@ -132,9 +227,9 @@ const getCoverHtmlStyle = ({ pageBreakBefore, }) => /* css */ ` | ||
export function generateCoverHtml({ imageSrc, imageAlt, language, title, stylesheets = [], styleOptions = {}, }) { | ||
const cover = h('html', { lang: language }, h('head', ...[ | ||
h('meta', { charset: 'utf-8' }), | ||
h('title', title ?? ''), | ||
h('style', getCoverHtmlStyle(styleOptions)), | ||
...stylesheets.map((s) => h('link', { type: 'text/css', href: s, rel: 'stylesheet' })), | ||
].filter((n) => !!n)), h('body', h('section', { role: 'region', ariaLabel: 'Cover' }, h('img', { src: imageSrc, alt: imageAlt, role: 'doc-cover' })))); | ||
return prettier.format(toHTML(cover), { parser: 'html' }); | ||
const cover = (_jsxs("html", { lang: language, children: [_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("title", { children: title || '' }), (() => { | ||
const style = getCoverHtmlStyle(styleOptions); | ||
return style ? _jsx("style", { children: style }) : null; | ||
})(), stylesheets.map((s) => (_jsx("link", { type: "text/css", href: s, rel: "stylesheet" })))] }), _jsx("body", { children: _jsx("section", { role: "region", "aria-label": "Cover", children: _jsx("img", { src: imageSrc, alt: imageAlt, role: "doc-cover" }) }) })] })); | ||
return prettier.format(toHtml(cover, { allowDangerousHtml: true }), { | ||
parser: 'html', | ||
}); | ||
} | ||
@@ -141,0 +236,0 @@ export function processManuscriptHtml(filepath, { title, style, contentType, language, }) { |
declare const vivliostyleConfigSchema: any; | ||
export { vivliostyleConfigSchema }; | ||
export type StructuredDocument = { | ||
title: string; | ||
href: string; | ||
sections?: StructuredDocumentSection[]; | ||
children: StructuredDocument[]; | ||
}; | ||
export type StructuredDocumentSection = { | ||
headingHtml: string; | ||
headingText: string; | ||
level: number; | ||
href?: string; | ||
id?: string; | ||
children: StructuredDocumentSection[]; | ||
}; | ||
//# sourceMappingURL=vivliostyle.d.ts.map |
@@ -40,3 +40,3 @@ /** | ||
/** | ||
* @deprecated Use `copyAsset.includes` instead | ||
* @deprecated Use 'copyAsset.includes' instead | ||
*/ | ||
@@ -80,7 +80,33 @@ includeAssets?: Entry[] | Entry; | ||
/** | ||
* Specify whether to generate a table of contents (ToC) document. If a string is set, the ToC document will be saved at that location. (default: index.html) | ||
* Options about Table of Contents (ToC) documents. | ||
*/ | ||
toc?: boolean | string; | ||
toc?: boolean | string | { | ||
/** | ||
* Specify the title of the generated ToC document. | ||
*/ | ||
title?: string; | ||
/** | ||
* Specify the location where the generated ToC document will be saved. (default: index.html) | ||
*/ | ||
htmlPath?: string; | ||
/** | ||
* Specify the depth of the section to be included in the ToC document. (default: 0) | ||
*/ | ||
sectionDepth?: number; | ||
/** | ||
* Specify the transform function for the document list. | ||
*/ | ||
transformDocumentList?: (nodeList: import('@vivliostyle/cli').StructuredDocument[]) => (propsList: { | ||
children: any; | ||
}[]) => any; | ||
/** | ||
* Specify the transform function for the section list. | ||
*/ | ||
transformSectionList?: (nodeList: import('@vivliostyle/cli').StructuredDocumentSection[]) => (propsList: { | ||
children: any; | ||
}[]) => any; | ||
[k: string]: unknown; | ||
}; | ||
/** | ||
* Specify the title of the generated ToC document. | ||
* @deprecated Use 'toc.title' instead | ||
*/ | ||
@@ -87,0 +113,0 @@ tocTitle?: string; |
{ | ||
"name": "@vivliostyle/cli", | ||
"description": "Save the pdf file via headless browser and Vivliostyle.", | ||
"version": "8.10.0", | ||
"version": "8.11.0", | ||
"author": "spring_raining <harusamex.com@gmail.com>", | ||
@@ -42,2 +42,3 @@ "type": "module", | ||
"decamelize": "5.0.0", | ||
"dompurify": "^3.1.2", | ||
"execa": "^5.1.1", | ||
@@ -48,4 +49,4 @@ "fast-glob": "3.2.12", | ||
"globby": "13.1.2", | ||
"hast-util-to-html": "^7.1.3", | ||
"hastscript": "^6.0.0", | ||
"hast-util-to-html": "^9.0.1", | ||
"hastscript": "^9.0.0", | ||
"ignore": "5.2.4", | ||
@@ -78,2 +79,3 @@ "is-interactive": "1.0.0", | ||
"@types/debug": "^4.1.7", | ||
"@types/dompurify": "^3.0.5", | ||
"@types/fs-extra": "^11.0.1", | ||
@@ -80,0 +82,0 @@ "@types/github-slugger": "^1.3.0", |
@@ -295,3 +295,3 @@ { | ||
"toc": { | ||
"description": "Specify whether to generate a table of contents (ToC) document. If a string is set, the ToC document will be saved at that location. (default: index.html)", | ||
"description": "Options about Table of Contents (ToC) documents.", | ||
"oneOf": [ | ||
@@ -302,2 +302,34 @@ { "type": "boolean" }, | ||
"minLength": 1 | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"title": { | ||
"description": "Specify the title of the generated ToC document.", | ||
"type": "string", | ||
"minLength": 1 | ||
}, | ||
"htmlPath": { | ||
"description": "Specify the location where the generated ToC document will be saved. (default: index.html)", | ||
"type": "string", | ||
"minLength": 1 | ||
}, | ||
"sectionDepth": { | ||
"description": "Specify the depth of the section to be included in the ToC document. (default: 0)", | ||
"type": "integer", | ||
"minimum": 0, | ||
"maximum": 6 | ||
}, | ||
"transformDocumentList": { | ||
"description": "Specify the transform function for the document list.", | ||
"instanceOf": "Function", | ||
"tsType": "(nodeList: import('@vivliostyle/cli').StructuredDocument[]) => (propsList: { children: any }[]) => any" | ||
}, | ||
"transformSectionList": { | ||
"description": "Specify the transform function for the section list.", | ||
"instanceOf": "Function", | ||
"tsType": "(nodeList: import('@vivliostyle/cli').StructuredDocumentSection[]) => (propsList: { children: any }[]) => any" | ||
} | ||
}, | ||
"required": [] | ||
} | ||
@@ -307,3 +339,4 @@ ] | ||
"tocTitle": { | ||
"description": "Specify the title of the generated ToC document.", | ||
"deprecated": true, | ||
"description": "@deprecated Use 'toc.title' instead", | ||
"type": "string", | ||
@@ -310,0 +343,0 @@ "minLength": 1 |
@@ -1,3 +0,1 @@ | ||
declare module 'hastscript'; | ||
declare type Without<T> = { [P in keyof T]?: never }; | ||
@@ -4,0 +2,0 @@ type Tail<T extends any[]> = T extends [any, ...infer XS] ? XS : never; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
561989
8464
44
37
+ Addeddompurify@^3.1.2
+ Added@types/hast@3.0.4(transitive)
+ Added@types/mdast@4.0.4(transitive)
+ Added@types/trusted-types@2.0.7(transitive)
+ Added@types/unist@3.0.3(transitive)
+ Added@ungap/structured-clone@1.3.0(transitive)
+ Addedccount@2.0.1(transitive)
+ Addedcharacter-entities-html4@2.1.0(transitive)
+ Addedcharacter-entities-legacy@3.0.0(transitive)
+ Addedcomma-separated-tokens@2.0.3(transitive)
+ Addeddequal@2.0.3(transitive)
+ Addeddevlop@1.1.0(transitive)
+ Addeddompurify@3.2.4(transitive)
+ Addedhast-util-parse-selector@4.0.0(transitive)
+ Addedhast-util-to-html@9.0.5(transitive)
+ Addedhast-util-whitespace@3.0.0(transitive)
+ Addedhastscript@9.0.1(transitive)
+ Addedhtml-void-elements@3.0.0(transitive)
+ Addedmdast-util-to-hast@13.2.0(transitive)
+ Addedmicromark-util-character@2.1.1(transitive)
+ Addedmicromark-util-encode@2.0.1(transitive)
+ Addedmicromark-util-sanitize-uri@2.0.1(transitive)
+ Addedmicromark-util-symbol@2.0.1(transitive)
+ Addedmicromark-util-types@2.0.1(transitive)
+ Addedproperty-information@7.0.0(transitive)
+ Addedspace-separated-tokens@2.0.2(transitive)
+ Addedstringify-entities@4.0.4(transitive)
+ Addedtrim-lines@3.0.1(transitive)
+ Addedunist-util-is@6.0.0(transitive)
+ Addedunist-util-position@5.0.0(transitive)
+ Addedunist-util-stringify-position@4.0.0(transitive)
+ Addedunist-util-visit@5.0.0(transitive)
+ Addedunist-util-visit-parents@6.0.1(transitive)
+ Addedvfile@6.0.3(transitive)
+ Addedvfile-message@4.0.2(transitive)
+ Addedzwitch@2.0.4(transitive)
Updatedhast-util-to-html@^9.0.1
Updatedhastscript@^9.0.0