block

unorderedList

Wire value: "unorderedList"

Appears on: Documentation Topic, Tutorial (Project), Tutorial Article

1. How swift-docc-render consumes this

A grep of src/components/ for the literal string "unorderedList" lands on the same single dispatch file every block/inline kind on this reference site is documented against: src/components/ContentNode.vue. Near the top of the file, the BlockType wire constants object declares unorderedList: 'unorderedList' (ContentNode.vue#L37-L54). That constant is one arm of the renderNode() factory function's switch (node.type) dispatch table:

case BlockType.unorderedList: {
  const isTaskList = list => TaskList.props.tasks.validator(list.items);
  return isTaskList(node) ? (
    createElement(TaskList, {
      props: {
        tasks: node.items,
      },
      scopedSlots: {
        task: slotProps => renderChildren(slotProps.task.content),
      },
    })
  ) : (
    createElement('ul', {}, (
      renderListItems(node.items)
    ))
  );
}

(ContentNode.vue#L354-L370.) Unlike orderedList (a simple <ol> with a start attribute, at ContentNode.vue#L297-L304), unorderedList has a branch: it first checks whether the list is really a Markdown task list by delegating to the child component's own prop validator, TaskList.props.tasks.validator, which returns true if any item in node.items has a checked property at all (ContentNode/TaskList.vue#L20-L39):

const hasCheckedProp = obj => Object.hasOwnProperty.call(obj, CHECKED_PROP);

export default {
  name: 'TaskList',
  props: {
    tasks: {
      required: true,
      type: Array,
      // A task list is an unordered list that has at least one item with a
      // boolean `checked` property
      validator: list => list.some(hasCheckedProp),
    },
  },
  methods: {
    showCheckbox: hasCheckedProp,
  },
};

If that validator passes, the whole node is handed to <TaskList> (ContentNode/TaskList.vue#L11-L18), whose template renders a <ul class="tasklist"> and, for each task, a disabled <input type="checkbox"> bound to that item's checked value — but only for items that themselves carry the checked property (mixed task/non-task items in the same list are supported; only the ones with checked get a checkbox). Otherwise — the common case, a plain bulleted list with no checked field on any item — renderNode() falls through to the plain branch and calls the shared renderListItems() helper directly:

const renderListItems = items => items.map(item => (
  createElement('li', {}, (
    renderChildren(item.content)
  ))
));

(ContentNode.vue#L126-L130, shared with the orderedList branch.) Each item's content array — itself a nested array of RenderBlockContent, almost always one or more paragraphs — is recursed through renderChildren()/renderNode() to become the <li>'s children, which is how nested lists, code listings, or other block content inside a bullet point get rendered. The type: 'unorderedList' constant also appears in two generic content-tree-walking helpers in the same file, the map() mixin (ContentNode.vue#L576-L584) and the forEach() mixin (ContentNode.vue#L629-L632), both of which group unorderedList with orderedList since the two share the exact same items[].content shape — these are not separate rendering paths, just tree-traversal utilities used for other purposes (e.g. plain-text extraction).

ContentNode.vue itself has no template and no <style> block — it is a render-function-only component, so the bare <ul> path contributes no CSS of its own beyond the element; only the task-list branch pulls in a component (TaskList.vue) that carries its own scoped stylesheet (see Section 4).

2. Example JSON and rendered mockup

Real fixture: Tests/SwiftDocCTests/Rendering/Rendering Fixtures/term-lists-3.json in the swift-docc test suite (no unorderedList node was found in DocCArchive's own ExampleDocs.doccarchive/SampleLibrary.doccarchive fixtures), field primaryContentSections[0].content[1] — a plain, non-task bulleted list with a single item whose content spans multiple inline text runs.

{
  "type": "unorderedList",
  "items": [
    {
      "content": [
        {
          "type": "paragraph",
          "inlineContent": [
            { "type": "text", "text": "Not a term list, and" },
            { "type": "text", "text": " " },
            { "type": "text", "text": "spans multiple lines." }
          ]
        }
      ]
    }
  ]
}

No fixture in either test suite exercises the task-list branch (an item with a checked boolean), so this second snippet illustrating that variant is hand-written and schema-valid but synthetic:

{
  "type": "unorderedList",
  "items": [
    { "checked": true,  "content": [ { "type": "paragraph", "inlineContent": [ { "type": "text", "text": "Ship the schema reference" } ] } ] },
    { "checked": false, "content": [ { "type": "paragraph", "inlineContent": [ { "type": "text", "text": "Write the CSS survey" } ] } ] }
  ]
}
  • Not a term list, and spans multiple lines.

task-list variant (synthesized):

  • Ship the schema reference
  • Write the CSS survey

mockup: a plain <ul> of <li> elements for the ordinary case; when at least one item carries checked, the whole list is instead rendered by TaskList.vue as <ul class="tasklist"> with a disabled checkbox per checked/unchecked item.

3. Data sheet

Source: Sources/DocCArchive/Vendored/RenderNode.spec.json, schema object #/components/schemas/UnorderedList (lines 903–923), with the shared #/components/schemas/ListItem object (lines 924–940) it references; cross-checked against Components.Schemas.UnorderedList and Components.Schemas.ListItem in Sources/DocCArchive/generated/Types.swift (lines 4390–4438). UnorderedList is one arm of the RenderBlockContent discriminated union.

FieldTypeRequiredEnum values / defaultNote
type string yes "unorderedList" (single-value enum) Generated as _TypePayload: String, Codable, Hashable, Sendable, CaseIterable { case unorderedList = "unorderedList" }, decoded under the Swift property name _type via an explicit CodingKeys mapping (case _type = "type").
items array of ListItem yes — The list's bullet items, in document order. No minimum-length constraint in the schema (an empty array is technically valid wire data, though swift-docc's Markdown-to-RenderNode conversion would never emit one for an authored list).
items[].content array of RenderBlockContent yes (on ListItem) — The block content inside one bullet — almost always a single paragraph, but can be anything block-level (a nested unorderedList/orderedList, a codeListing, etc.), enabling nested lists and multi-paragraph list items.
items[].checked boolean no no default (absent = "not a task item") Presence — not truthiness — is what matters: ContentNode.vue's task-list detection (list.some(hasCheckedProp), via Object.hasOwnProperty) treats an item with "checked": false as still being a task item, distinct from an item that omits the key entirely. If any item in the list has this key, swift-docc-render renders the whole list as a task list, not just the flagged items.

Unlike OrderedList — whose sibling schema object and generated Swift struct both carry a start/startIndex field defaulting to 1 — UnorderedList has no ordering/index field at all; this matches its decode-side implementation in swift-docc's Swift model (see below), which reads only items for this case.

On the swift-docc production side (secondary/flavor source, not authoritative for wire shape), the enclosing Swift type is declared at Sources/SwiftDocC/Model/Rendering/Content/RenderBlockContent.swift: the enum case case unorderedList(UnorderedList) (line 51) and the nested struct public struct UnorderedList: Equatable { public var items: [ListItem] } (lines 474–483). The shared ListItem struct (lines 588–599) declares content: [RenderBlockContent] and checked: Bool?, with a doc comment reading "If this list item is a task list item, whether the task should be checked off" — confirming the render-side "presence, not truthiness" semantics observed in TaskList.vue. The manual Codable conformance's decoder (around line 1076) decodes exactly self = try .unorderedList(.init(items: container.decode([ListItem].self, forKey: .items))) — no start/index field is read for this case, confirming the data-sheet field list above. Authoring-side, an unorderedList node is what swift-docc emits for a standard CommonMark bulleted list (lines beginning with -, *, or +); a task list is the GitHub-Flavored-Markdown-style checkbox extension, a bullet item beginning with [ ] or [x], which is what populates the optional checked field on the corresponding ListItem.

4. HTML/CSS mapping in DocC-Render output

Rendered DOM for an unorderedList node, in context, has two shapes depending on the task-list branch taken in Section 1:

SCSS: neither ContentNode.vue nor the plain-ul path has any component-scoped style — a plain bulleted list is styled entirely by global rules:

TaskList.vue's scoped style block (ContentNode/TaskList.vue#L42-L63) overrides the above for the task-list case: it declares and consumes three local CSS custom properties, --checkbox-width (1rem), --indent-width (calc(var(--checkbox-width) / 2)), and --content-margin (defaults to var(--indent-width), overridden to calc(var(--checkbox-width) + var(--indent-width)) when a task's content is a lone <p>); sets list-style-type: none and a smaller margin-left: var(--indent-width) on .tasklist itself (replacing the default bullet-and-indent rules above); and makes a checkbox-adjacent paragraph display: inline-block so the checkbox and its label text sit on one line.

5. Modern CSS-only alternative

Not applicable

Current behavior in play: for the plain-list branch, rendering is stateless — renderNode() maps the JSON node straight to a static <ul>/<li> tree at render time, no client-side interaction involved. For the task-list branch, TaskList.vue renders <input type="checkbox" disabled :checked="task.checked"> — the disabled attribute is set unconditionally in the template, so even this checkbox carries no interactive/toggle behavior at runtime; it exists purely to render a fixed, already-decided checked/unchecked glyph baked in from the RenderNode JSON at build time. There is no click handler, no v-model, no component data() tracking toggle state, and nothing a reader can check or uncheck in the rendered page.

Concretely: none of the interactive-state mechanisms this survey looks for (<details>/<summary>, radio-input :checked plus a general sibling selector, :target, the Popover API, <dialog>, :has(), container queries, CSS anchor positioning, view transitions) apply here, because a list — plain or task — is rendered once from static data and never mutates in the browser. The disabled checkbox in the task-list case is arguably the closest thing to "state" on this page, but it is inert markup, not a state-holding control (no CSS or JS ever reads or writes its checked DOM property after mount) — so there is nothing for a native mechanism to replace.