mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-19 06:35:44 +01:00
Answer architecture round 1: splitTaskList groups a list into items, bulletBlocks returns the split blocks itself, isTaskItem lives in adf/, a property reads generated task lists through portableMarkdownToAdf, and items 56 and 93 name today's code
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { AdfNode } from './document.ts'
|
||||
import type { AttributeVocabulary } from './attribute-vocabulary.ts'
|
||||
|
||||
export type BlockNodeModel = {
|
||||
@@ -88,6 +89,10 @@ export function blockNodeModel(type: string): BlockNodeModel | undefined {
|
||||
return isBlockType(type) ? blockNodes[type] : undefined
|
||||
}
|
||||
|
||||
export function isTaskItem(node: AdfNode | undefined): boolean {
|
||||
return node?.type === 'taskItem' || node?.type === 'blockTaskItem'
|
||||
}
|
||||
|
||||
function isBlockType(type: string): type is BlockType {
|
||||
return Object.hasOwn(blockNodes, type)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user