/** * Resolve a parsed markdown block into its placement-ready metadata: * style, VDT type, heading/list attributes, and a `contentBlock` that may * differ from `rawBlock` when a heading numbering prefix has been prepended. */ import type { ContentBlock, ListKind } from '../parse/index.js'; import type { Resource, ResourceType } from '../types.js'; import type { ResolvedConfig, VDTBlock } from '../vdt.js'; import type { BlockStyle } from './styles.js'; import type { ListBulletStyle, OrderedListMetrics } from './lists.js'; import type { HeadingLevelResolver } from './headingStyles.js'; export interface BlockKind { style: BlockStyle; vdtType: VDTBlock['type']; headingLevel?: number; numberPrefix?: string; /** What joins the number to the title, when it is not one space (see * `VDTBlock.numberSeparator`). */ numberSeparator?: string; /** A numbered heading's counter value (see `VDTBlock.headingNumber`). */ headingNumber?: number; /** A numbered heading whose number and separator end in 、 or ・: how * many UTF-16 units of the text they take, so the composer does not * read the mark as part of a number with the title * (`MeasureBlockOptions.labelLength`, #679). */ numberLabelLength?: number; contentBlock: ContentBlock; listBullet?: ListBulletStyle; listDepth?: number; listKind?: ListKind; bulletXOffsetInColumn: number; strikethroughText: boolean; /** For `resource` blocks: the resolved `Resource` referenced by the * `::resource{id=…}` directive, or undefined when the id is unknown. */ resource?: Resource; /** For `resource` blocks: the `ResourceType` of the resolved resource. */ resourceType?: ResourceType; /** For `resource` blocks: the computed number string (e.g. `"1.7"`). */ resourceNumber?: string; } export interface BlockKindContext { resolved: ResolvedConfig; bodyStyle: BlockStyle; blockquoteStyle: BlockStyle; headingPrefixes: Array; /** Counter value of every numbered heading, by block index. */ headingNumbers?: Array; blockIdx: number; listLevelIndentsPx: number[]; orderedLevelIndentsPx: number[]; orderedMetrics: OrderedListMetrics; /** Resource lookup by id (for resolving `::resource{id=…}` blocks). */ resourceById: Map; /** Resource-type lookup by id. */ resourceTypeById: Map; /** Computed resource number strings keyed by resource id. */ resourceNumberById: Map; /** Style forced onto `paragraph` blocks by an enclosing `:::paragraphs` * container; the body style applies when unset. */ paragraphStyleOverride?: BlockStyle; /** Level configs with heading-style overrides merged in; the plain level * lookup applies when unset. */ headingLevels?: HeadingLevelResolver; } /** A heading's own `{indent=N}` (字下げ, #467) over its level's or style's * `indent`: counted in body characters as the level's is (JLReq §4.1.3 * sets headings 4, 6 or 8 字 down by level, and Aozora records each * heading's own: [#5字下げ]一), so a bare number and `em` are body * ems; `0` sets the heading at the line start. * Anything that is not a length leaves the level's indent as it is. */ export declare function withHeadingIndentAttr(style: BlockStyle, value: string | undefined, resolved: ResolvedConfig): BlockStyle; /** A heading's own `{firstLineIndent=N}` (#636) over its level's or * style's `firstLineIndent`, read as `{indent=N}` is: body ems for a bare * number and `em`, `0` clears it, anything that is not a length leaves * the level's as it is. */ export declare function withHeadingFirstLineIndentAttr(style: BlockStyle, value: string | undefined, resolved: ResolvedConfig): BlockStyle; /** Upper-case `text` one UTF-16 code unit at a time, keeping any character * whose upper-case form is not exactly one code unit (`ß` → `SS`, ligatures) * so the result has the same length as the input and per-character source * maps remain valid. */ export declare function uppercasePreservingLength(text: string): string; export declare function resolveBlockKind(rawBlock: ContentBlock, ctx: BlockKindContext): BlockKind; /** The space a poem's paragraph style asks above it (0 without one). */ export declare function verseMarginTopPx(styleId: string | undefined, resolved: ResolvedConfig): number; //# sourceMappingURL=buildBlockKind.d.ts.map