block

paragraph

Wire value: "paragraph"

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

1. How swift-docc-render consumes this

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

case BlockType.paragraph: {
  const hasSingleImage = node.inlineContent.length === 1
    && node.inlineContent[0].type === InlineType.image;
  const props = hasSingleImage ? { class: ['inline-image-container'] } : {};

  return createElement('p', props, (
    renderChildren(node.inlineContent)
  ));
}

(ContentNode.vue#L305-L313.) A paragraph node is rendered as a plain <p> element with no dedicated Vue component — its inlineContent array is recursively mapped through the same renderNode()/renderChildren() pair to become the paragraph's child nodes (text runs, codeVoice, emphasis, reference links, inline images, etc.). There is one special case: if the paragraph's inlineContent is exactly one image node, the resulting <p> is given the extra class inline-image-container instead of any structural change — this is purely a styling hook (see Section 4) for "a paragraph that is really just a standalone image."

The type: 'paragraph' string constant is also matched in two other places in the same file: the content-tree traversal helpers map() (ContentNode.vue#L564-L575) and forEach() (ContentNode.vue#L619-L628), which both group BlockType.paragraph together with the various inline kinds because a paragraph, structurally, is just a container whose only child field is inlineContent — the same shape as emphasis, strong, newTerm, etc. A third use appears in the plaintext computed property (ContentNode.vue#L680-L698), which reduces a content tree to a single plain-text string for use in things like search snippets and metadata descriptions; there, encountering a paragraph node simply appends a newline (if (node.type === BlockType.paragraph) { return \`${text}\n\`; }) — the actual text comes from the nested text/codeVoice/reference inline nodes visited later in the same reduce.

ContentNode.vue itself has no template and no <style> block — it is a render-function-only component, so it contributes no markup or CSS of its own beyond the bare <p> tag. It is always mounted from a wrapping component (for a symbol/article page, src/components/DocumentationTopic/ContentNode.vue, a thin re-export wrapper that supplies the scoped stylesheet — see Section 4) whose own root element wraps the array of block nodes, of which a given paragraph is one item.

2. Example JSON and rendered mockup

Real fixture: Tests/DocCArchiveTests/Fixtures/ExampleDocs.doccarchive/data/documentation/exampledocs/examplearticle.json, field primaryContentSections[0].content[1] — one of two paragraph nodes in that article's rendered content array (the other, content[4], is identical in shape). This is the RenderNode swift-docc produced for an authored Markdown paragraph of plain prose.

{
  "type": "paragraph",
  "inlineContent": [
    {
      "type": "text",
      "text": "Description of what the article is about - the problem being solved, etc."
    }
  ]
}

Description of what the article is about - the problem being solved, etc.

mockup: a single <p> element containing the rendered inlineContent — here just one text run, but the same slot can hold any mix of codeVoice, emphasis/strong, reference links, image, newTerm, etc. No border, background, or icon is added by the paragraph renderer itself; all visible spacing comes from the surrounding stylesheet (Section 4), not from anything on the <p> element or its props.

3. Data sheet

Source: Sources/DocCArchive/Vendored/RenderNode.spec.json, schema object #/components/schemas/Paragraph (lines 858–878), cross-checked against Components.Schemas.Paragraph in Sources/DocCArchive/generated/Types.swift (lines 4330–4355). Paragraph is one arm of the RenderBlockContent discriminated union that makes up the content array of a ContentRenderSection (and of any other block-content-bearing container, e.g. an aside, list item, or table cell).

FieldTypeRequiredEnum values / defaultNote
type string yes "paragraph" (single-value enum) Generated as _TypePayload: String, Codable, Hashable, Sendable, CaseIterable { case paragraph = "paragraph" }, decoded/encoded under the Swift property name _type via an explicit CodingKeys mapping (case _type = "type") since type is not a legal Swift identifier for a stored property name colliding with the type-erasure convention the generator uses for discriminator fields.
inlineContent array of RenderInlineContent yes — The paragraph's rendered inline runs (text, code voice, emphasis/strong, links, inline images, new terms, super/subscript, strikethrough). Matches swift-docc's Swift-side RenderBlockContent.Paragraph.inlineContent: [RenderInlineContent] exactly — no schema/model mismatch for this kind.

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 paragraph(Paragraph) (line 41) and the nested struct public struct Paragraph: Equatable { public var inlineContent: [RenderInlineContent] } (lines 96–104). The doc comment on the enclosing RenderBlockContent enum (lines 14–38) describes block elements generally as introducing "a break in their container's layout flow" and gives paragraphs as the canonical example in its ASCII diagram of stacked blocks. Authoring-side, a paragraph node is simply what swift-docc emits for any run of Markdown text separated from its neighbors by a blank line — there is no special directive or syntax an author writes to "create" a paragraph; it is the default block kind for prose.

4. HTML/CSS mapping in DocC-Render output

Rendered DOM for a paragraph node, in context:

SCSS: ContentNode.vue itself carries no <style> block, so a <p> paragraph is styled entirely by global/inherited rules, not by anything scoped to the paragraph renderer:

CSS custom properties consumed: --spacing-stacked-margin-large and --spacing-stacked-margin-xlarge (both defined on body in _reset.scss lines 39–45, as 0.4em-derived values); the inline-image-container rule also resolves through var(--spacing-stacked-margin-xlarge, ...) by way of the shared between-els() Sass helper. No paragraph-specific custom property exists — paragraphs consume the same generic stacking-spacing variables every other block kind consumes.

5. Modern CSS-only alternative

Not applicable

Current behavior in play: rendering a paragraph node involves no JavaScript state at all — ContentNode.vue's renderNode() is a pure, one-shot function that maps a JSON node to a static <p> element at render time (with one non-interactive, data-driven class toggle for the single-image case). There is no click handler, no v-show/v-if toggle, no component data() tracking open/closed or active/inactive state, and no client-side behavior to reproduce after the initial paint. The vertical-spacing rules described in Section 4 (p + *, the between-els() sibling-margin helper) are already plain CSS adjacent-sibling selectors — not JavaScript — so there is nothing to "port" to a modern CSS mechanism in the first place.

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 none of them are standing in for anything this kind currently does — a paragraph is, and always was, a static leaf of markup. The verdict is "not applicable" for the same reason a plain <span> or <em> would be: there is no state to hold.