/** * Content warnings — references and markup the source names wrongly, which * the layout sets in a fallback without failing: an unknown `:ref` prints * `?`, an unknown `:::name` line prints as text, an unknown style id falls * back to a default, a ragged table grid shifts its cells. They are read * from the source and the configuration alone (no layout), so an editor can * list them while the document is still being laid out; the build lists * them in `VDTDocument.contentWarnings`, located on the page each construct * landed on. */ import type { PostextConfig, Resource } from '../types.js'; import type { ConfigWarning, ContentWarning, LayoutWarning, RenderWarning, VDTDocument } from '../vdt.js'; import type { HeadingDesignCut } from './headingDesignCuts.js'; /** The fullwidth markup of one source line — the first on the line — or * undefined. `at` is its offset in the line. */ export declare function fullwidthMarkupIn(line: string): { typed: string; ascii: string; at: number; } | undefined; /** * Warnings for the references and markup of `markdown` that the build cannot * resolve as written: unknown resource ids (embeds, inline `:ref`s, cell * images — in the text and in the captions, notes and cells of the * resources it uses), unknown `:::name` lines, `::name` embed lines set as * text, unknown paragraph, callout, chip, heading and table style ids, and * table grids that are not rectangular once their merges are counted (see * `tableGridIssues`). * * Offsets are absolute in `markdown` (frontmatter included); resource-level * warnings point at the resource's first embed or reference. The result * has no `pageIndex` — the build adds it. */ export declare function collectContentWarnings(markdown: string, config?: PostextConfig, resources?: readonly Resource[], /** The anchor ids of the whole book (#262), when the document is one of * its chapters; its own anchors count either way. */ bookAnchors?: ReadonlySet, /** The reference keys of the whole book (#268), when the document is one * of its chapters; its own references count either way. */ bookCitationKeys?: ReadonlySet): ContentWarning[]; /** * The page each content warning's construct was placed on: the first placed * block of the resource a resource-level warning names, else the first * block whose source range holds the warning's start. Warnings whose * construct put nothing on a page keep no `pageIndex`. */ export declare function locateContentWarnings(doc: VDTDocument, warnings: readonly ContentWarning[]): ContentWarning[]; /** A `cjkLooseLine` warning for each justified CJK line set short with the * capped tracking (`VDTLine.cjkLoose`), on the page it was placed on. */ export declare function cjkLooseLineWarnings(doc: VDTDocument): ContentWarning[]; /** A `raggedLine` warning for each line of a justified paragraph set * ragged because its word spaces would have stretched past 3× * (`VDTLine.raggedSpaceRatio`, #732), on the page it was placed on: the * running text, the paragraphs of a box and the notes at a column foot * (all of them blocks of the document). */ export declare function raggedLineWarnings(doc: VDTDocument): ContentWarning[]; /** A `wordDividedByCharacter` warning (a `wordDividedBySyllable` note) for * each line ending in a piece of a word wider than its whole measure that * the breaker cut to fit (`VDTLine.wordDivided`, #1150), in the flow, a * composed page's frames and design texts alike. And an * `unbreakableWordOverflow` warning for each line holding a word of a * joining script wider than the line (`VDTLine.wordOverflow`), on the page * it was placed on; and once per text for a design text line that does * (`VDTDesignTextLine.wordOverflow`: a running head repeats it on every * page), on the first page that shows it. */ export declare function wordOverflowWarnings(doc: VDTDocument): ContentWarning[]; /** A `designTextTruncated` warning for each design text cut to fit its * width (`VDTDesignTextBlock.truncated`, #628): one per element and page * for a heading design, a part page or a contents part row; one per * element and chapter for a running head or folio, which repeats the cut * on every page (a chapter title, a folio's page number), on the first * page that shows it. */ export declare function designTruncationWarnings(doc: VDTDocument): ContentWarning[]; /** A `joiningScriptLetterSpacing` warning for the first placed part of * each block (by content index, `blocks`) whose style tracks words of a * joining script, which are set untracked. */ export declare function joiningLetterSpacingWarnings(doc: VDTDocument, blocks: ReadonlySet): ContentWarning[]; /** A `floatShrunk` warning for each floated picture the layout set smaller * to fit the room of its slot (`placement.shrink`, #626), with how far it * still runs past the text block's foot when even its smallest scale did * not fit. `sourceRangeOf` gives the range of the content block that first * cites it. */ export declare function floatShrinkWarnings(doc: VDTDocument, sourceRangeOf?: (contentIndex: number) => { start: number; end: number; } | undefined): ContentWarning[]; /** A `pictureBelowPrintSize` warning (#901) for each bitmap with a print * size that its column holds at under half of it, on a page whose text * block is wider than the column: a picture meant to fill a page, set in * one of its two default columns. A print size is the resource's own * `bitmap.resolution` or a number in `layout.bitmapResolution` (a * resolution read from the file under `'file'` is no statement of the * author's). A picture narrowed on purpose (`placement.width`), shrunk to * its slot (`floatShrunk`), turned, or set in a composed page's frame is * left alone. `resources` are the document's, as given (before the * layout stamps its policy on them). Once per picture, where it is first * placed; `sourceRangeOf` gives the range of the content block citing it. */ export declare function pictureBelowPrintSizeWarnings(doc: VDTDocument, resources: readonly Resource[] | undefined, sourceRangeOf?: (contentIndex: number) => { start: number; end: number; } | undefined): ContentWarning[]; /** An `emptyCaption` warning (#1151) for each resource whose type gives a * caption prefix and whose own caption is empty: its caption line prints * the label and number alone. Once per resource, where it is first * placed (a page's columns, then its floats); `sourceRangeOf` gives the * range of the content block citing or embedding it. */ export declare function emptyCaptionWarnings(doc: VDTDocument, sourceRangeOf?: (contentIndex: number) => { start: number; end: number; } | undefined): ContentWarning[]; /** A `dropCap` warning for the first placed part of each paragraph (by * content index) whose drop cap could not be set as configured (#623). */ export declare function dropCapWarnings(doc: VDTDocument, notes: ReadonlyMap['reason']; handling?: 'reserve' | 'shrink' | 'skip'; lines?: number; }>): ContentWarning[]; /** * A one-line English description of a build, configuration or render * warning, for logs and simple diagnostics panels: * * ```ts * const all = [...(doc.warnings ?? []), ...(doc.contentWarnings ?? []), ...(doc.configWarnings ?? [])]; * for (const w of all) console.warn(formatWarning(w)); * // Unknown resource id "fig-map" in :ref — it prints "?" (page 2, offset 314) * // bodyText.fontFamily: font stack "Georgia, serif" — set in "Georgia" * ``` * * It describes the results of `collectHeadingDesignCuts(doc)` too. * Hosts that localise their messages switch on `kind` instead. */ export declare function formatWarning(w: LayoutWarning | ContentWarning | ConfigWarning | RenderWarning | HeadingDesignCut): string; //# sourceMappingURL=contentWarnings.d.ts.map