1. How swift-docc-render consumes this
Grepping src/components/ for the literal string 'thematicBreak' lands on
src/components/ContentNode.vue's wire-constant table
(ContentNode.vue#L37-L54),
whose thematicBreak key holds BlockType.thematicBreak = 'thematicBreak' (the last
entry in that object). That constant is matched in the module-level renderNode() factory
function's (defined at
ContentNode.vue#L121-L124)
switch (node.type) dispatch table:
case BlockType.thematicBreak:
return createElement(ThematicBreak);
(ContentNode.vue#L429-L430.)
This is the shortest case arm in the whole dispatch table: unlike every other block kind, it reads no
properties off node at all—the wire object carries no payload beyond its discriminator
(confirmed in Section 3), so there is nothing to forward as props or slots. The call delegates straight to a
dedicated child component, ThematicBreak, imported at
ContentNode.vue#L33
from
src/components/ContentNode/ThematicBreak.vue.
That component's entire template is a single, unadorned element:
<template>
<hr class="thematic-break" />
</template>
(ThematicBreak.vue#L10-L12.)
There is no <script> block, no props, no data(), and no
event handlers—this is the simplest component in the block-content dispatch table, a pure,
stateless mapping from the wire kind to a native <hr>. All visual treatment comes from
the scoped <style> block covered in Section 4.
2. Example JSON and rendered mockup
No literal RenderNode JSON fixture containing "thematicBreak" was found in
Tests/DocCArchiveTests/Fixtures/ (the only hits there are inside bundled, minified
*.js app assets shipped alongside the two example archives, not RenderNode data files) nor as a
JSON fixture file anywhere under Tests/SwiftDocCTests/. swift-docc's own test suite exercises
this kind only via Swift-literal assertions in
Tests/SwiftDocCTests/Rendering/RenderBlockContent_ThematicBreakTests.swift, which confirms that
Markdown thematic-break variants—---, ***, ___, their
space-separated forms (- - -, etc.), and runs of four or more characters—each compile to
a bare RenderBlockContent.thematicBreak case via
RenderContentCompiler.visitThematicBreak
(Sources/SwiftDocC/Model/Rendering/RenderContentCompiler.swift, lines 398–400:
mutating func visitThematicBreak(_ thematicBreak: ThematicBreak) -> [any RenderContent] { return
[RenderBlockContent.thematicBreak] }). No test asserts the serialized JSON shape directly (the
round-trip test, testThematicBreakCodability, only checks that decode(encode(x)) == x), so the
minimal object below is hand-written to match the wire schema in Section 3 and the encoder logic at
RenderBlockContent.swift lines 1217–1218 (case .thematicBreak: break—no
extra key is ever written beside type).
{
"kind": "article",
"primaryContentSections": [
{
"kind": "content",
"content": [
{
"type": "paragraph",
"inlineContent": [
{ "type": "text", "text": "Sloths climb slowly, but they climb with purpose." }
]
},
{ "type": "thematicBreak" },
{
"type": "paragraph",
"inlineContent": [
{ "type": "text", "text": "Everything below this line concerns hats." }
]
}
]
}
]
}
Sloths climb slowly, but they climb with purpose.
Everything below this line concerns hats.
mockup: a plain horizontal rule spanning the content column, with extra-large vertical margin above and below (see Section 4) — no label, icon, or interactive behavior of any kind.
3. Data sheet
Source: Sources/DocCArchive/Vendored/RenderNode.spec.json, schema object
#/components/schemas/ThematicBreak (lines 700–713), which is one arm of the
RenderBlockContent discriminated union (referenced at spec line 441). Cross-checked against
Components.Schemas.ThematicBreak in Sources/DocCArchive/generated/Types.swift
(lines 4083–4101).
| Field | Type | Required | Enum values / default | Note |
|---|---|---|---|---|
type |
string | yes | "thematicBreak" (single-value enum) |
Generated as _TypePayload: String, Codable, Hashable, Sendable, CaseIterable { case thematicBreak
= "thematicBreak" }, decoded/encoded under the Swift property name _type via
CodingKeys { case _type = "type" } (leading underscore because type collides with
a reserved identifier pattern used by the generator for discriminator fields on this schema). |
That is the entire schema object: ThematicBreak is the only member of
RenderBlockContent's oneOf union with just one property. The generated struct
confirms it holds nothing else:
public struct ThematicBreak: Codable, Hashable, Sendable {
@frozen public enum _TypePayload: String, Codable, Hashable, Sendable, CaseIterable {
case thematicBreak = "thematicBreak"
}
public var _type: Components.Schemas.ThematicBreak._TypePayload
public init(_type: Components.Schemas.ThematicBreak._TypePayload) {
self._type = _type
}
public enum CodingKeys: String, CodingKey {
case _type = "type"
}
}
On the swift-docc production side (secondary/flavor source, not authoritative for wire shape), the enclosing
enum case is a bare, payload-less case—case thematicBreak
(Sources/SwiftDocC/Model/Rendering/Content/RenderBlockContent.swift, line 82, with a doc comment
"An authored thematic break between block elements."), unlike almost every sibling case in
RenderBlockContent which wraps a dedicated payload struct (e.g. case
heading(Heading)). No swiftStructSite exists for this kind because none is needed: the
custom Decodable initializer simply does case .thematicBreak: self = .thematicBreak
(line 1124–1125) with no field reads, and the custom Encodable implementation does
case .thematicBreak: break (line 1217–1218) after already writing the shared
type discriminator—so no additional key is ever emitted. rawIndexableTextContent
likewise returns "" for this case (confirmed by
testThematicBreakIndexable in the test file cited in Section 2): a thematic break contributes no
searchable text.
An author produces this kind simply by writing a standard Markdown thematic-break rule—three or more
-, *, or _ characters (optionally space-separated) on their own
line—which swift-markdown parses as a Markdown.ThematicBreak markup node; swift-docc's
RenderContentCompiler.visitThematicBreak
(Sources/SwiftDocC/Model/Rendering/RenderContentCompiler.swift, lines 398–400) then maps
that markup node onto the render-side RenderBlockContent.thematicBreak case with no
transformation of any field, since there is nothing to carry over. There is no dedicated .docc
catalog authoring article for this concept (unlike, say, tab navigators or row/column layouts) because it is
plain CommonMark syntax rather than a DocC-specific directive.
DocCArchive's own transform layer does not yet do anything with this kind:
MyHTMLTransformer and MyMarkdownTransformer
(Sources/DocCArchive/DocCArchive.swift, lines 242–254) are still stub placeholders that
return a hardcoded HTML comment and an empty string respectively for an entire RenderNode, with
no per-block-kind switch reached yet—so a thematicBreak node parsed via
Components.Schemas.ThematicBreak is available on the decoded model today, but nothing in this
repository currently converts it into HTML or Markdown output.
4. HTML/CSS mapping in DocC-Render output
Rendered DOM for a thematicBreak node, in context:
hr.thematic-break— the entire output. A single, self-closing, native<hr>element with one class and no children, no attributes, and no wrapperdiv, fromThematicBreak.vue.
SCSS: ThematicBreak.vue carries its own scoped <style> block
(ThematicBreak.vue#L14-L23):
.thematic-break {
@include space-out-between-siblings(var(--spacing-stacked-margin-xlarge));
border-top-color: var(--color-grid, currentColor);
border-top-style: solid;
border-width: 1px 0 0 0;
}
The space-out-between-siblings mixin
(_helpers.scss#L298-L302)
expands to * + & { margin-top: $margin; } (plus a :deep(*) variant for
slotted content), i.e. it does not set its own bottom margin; instead it makes any element that
follows a preceding sibling take the extra-large top margin, which is how the break gets breathing room on
both sides purely through adjacent-sibling selectors rather than explicit margin-bottom on the
<hr> itself. border-width: 1px 0 0 0 together with
border-top-style: solid reduces the browser's default <hr> box (which
normally has a 2px inset/groove border on all sides plus default margins) down to a single 1px top rule,
with the element's own height otherwise collapsing to its content-box (empty) height.
CSS custom properties consumed: --spacing-stacked-margin-xlarge, defined as
calc(var(--spacing-stacked-margin-large) * 2) in
_typography.scss#L44-L45
(itself 0.8em * 2, since --spacing-stacked-margin-large: 0.8em is set a few lines
above), giving roughly 1.6em of top margin whenever a thematic break (or any block) follows a
sibling; and --color-grid, falling back to the CSS keyword currentColor if unset,
which in the light color scheme resolves to var(--color-fill-gray)
(_light.scss#L98,
itself a generated light-mode gray swatch) for the rule's color—the same token used elsewhere for
generic hairline dividers such as table borders (_vars.scss: $generic-border-style: 1px
solid var(--color-grid)).
5. Modern CSS-only alternative
Not applicable
Current behavior in play: none that involves JavaScript or component state. ThematicBreak.vue
has no <script> block, no props, no data(), no computed properties, and no
event handlers—it is a pure template-to-markup mapping (<hr class="thematic-break" />)
styled entirely by a static, scoped SCSS rule (Section 4). The Vue dispatch in
ContentNode.vue (case BlockType.thematicBreak: return createElement(ThematicBreak))
is likewise stateless: it reads no property off the wire node (there is none to read, per Section 3) and
makes no runtime decision.
This kind has no interactive or stateful behavior to replace with a native HTML/CSS mechanism, because it
never had any to begin with—a thematic break is a single, static, self-closing element whose only
"behavior" is horizontal-rule styling and vertical spacing, both already accomplished with a plain
<hr> and a CSS class in the current implementation. There is nothing here analogous to
the tab-selection state, disclosure toggling, or scroll-linked behavior that other kinds' Vue components
hold in JS; a modern-CSS-only alternative would look identical to what already exists (an
<hr> styled with border-top and margin), so there is no mechanism to name.