ListItem
import { ListItem } from "jsr:@ende/markdown";interface
interface ListItemA list item.
Example: Usage
import type { ListItem } from "@ende/markdown/types";
import { assertEquals } from "@ende/assert";
const node: ListItem = { type: "listItem", spread: false, checked: null, children: [] };
assertEquals(node.checked, null);
Example: A task list item
import type { ListItem } from "@ende/markdown/types";
import { assertEquals } from "@ende/assert";
// `- [x] Done` with the `gfm` option:
const node: ListItem = {
type: "listItem",
spread: false,
checked: true,
children: [{ type: "paragraph", children: [{ type: "text", value: "Done" }] }]
};
assertEquals(node.checked, true);
Properties
type
type: "listItem"Node type.
spread
spread: booleanWhether a blank line separates any of the item's direct children.
checked
checked: boolean | nullWhether a task list item is checked ([x]) or not ([ ]), or null if
the item isn't a task. Only the gfm option parses task list items; the
marker is removed from the item's first paragraph.
children
children: (BlockContent | DefinitionContent)[]The blocks in the item.