mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-19 06:35:44 +01:00
Answer principles round 1: 0 🔴, 3 🟡 (0 misread); row section field, one heading-level predicate, items 171-174 filed
This commit is contained in:
@@ -83,12 +83,18 @@ export const blockNodes = {
|
||||
taskList: { attributes: localIdAttributes, contentModel: 'block' },
|
||||
} satisfies Readonly<Record<string, BlockNodeModel>>
|
||||
|
||||
export const headingLevels: readonly number[] = [1, 2, 3, 4, 5, 6]
|
||||
|
||||
export type BlockType = keyof typeof blockNodes
|
||||
|
||||
export function blockNodeModel(type: string): BlockNodeModel | undefined {
|
||||
return isBlockType(type) ? blockNodes[type] : undefined
|
||||
}
|
||||
|
||||
export function isHeadingLevel(level: unknown): level is number {
|
||||
return typeof level === 'number' && headingLevels.includes(level)
|
||||
}
|
||||
|
||||
export function isTaskItem(node: AdfNode | undefined): boolean {
|
||||
return node?.type === 'taskItem' || node?.type === 'blockTaskItem'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user