1. How swift-docc-render consumes this
Grepping src/components/ for the literal string 'small' lands on
src/components/ContentNode.vue's wire-constant table
(ContentNode.vue#L37-L54),
whose small key holds BlockType.small = 'small'. That constant is matched in the
renderNode() factory function's switch (node.type) dispatch table:
case BlockType.small: {
return createElement('p', {}, [
createElement(Small, {}, renderChildren(node.inlineContent)),
]);
}
(ContentNode.vue#L377-L381.)
Two things are notable in this one case arm. First, the dispatch wraps the delegated component in a plain
HTML <p> element rather than handing the wrapper element to the child component itself —
so a small block always produces a paragraph containing a <small>, not a bare
<small>. Second, node.inlineContent is passed straight through
renderChildren(children)
(ContentNode.vue#L122-L129),
the same generic inline-content-array-to-VNodes helper used by paragraphs, headings, and asides — small
gets no bespoke inline handling, it just recurses into the standard RenderInlineContent
dispatch (codeVoice, emphasis, strong, text, etc.).
The delegation target, Small, is imported from
src/components/ContentNode/Small.vue
(ContentNode.vue#L25).
Small.vue is the entire component, in full — there is no JS logic at all, only a template and a
scoped style block:
<template>
<small>
<slot />
</small>
</template>
<script>
export default {
name: 'Small',
};
</script>
<style scoped lang='scss'>
@import 'docc-render/styles/_core.scss';
small {
@include font-styles(body-reduced-tight);
color: var(--color-figure-gray);
}
</style>
(Small.vue#L11-L30.)
It renders the native HTML <small> element and forwards its default slot (the VNodes
built by renderChildren in the caller) directly inside. There is no component state, no props,
and no conditional logic of any kind — this is one of the simplest components in the codebase: a styled
pass-through around the browser's own <small> tag.
2. Example JSON and rendered mockup
No literal wire-format JSON fixture containing "type": "small" was found in either
Tests/DocCArchiveTests/Fixtures/ (the only hits there for the string "small" are
inside bundled, minified *.js app assets — unrelated JS identifiers, not RenderNode data) or as
a JSON fixture in Tests/SwiftDocCTests/. swift-docc's own test suite exercises this kind only via
Swift-literal assertions in
Tests/SwiftDocCTests/Semantics/Reference/SmallTests.swift (e.g. testHasContent,
which asserts @Small { This is my copyright text. } lowers to
.small(RenderBlockContent.Small(inlineContent: [.text("This is my copyright text.")]))). The JSON
below is hand-written to match that documented shape and the schema in Section 3.
{
"type": "small",
"inlineContent": [
{ "type": "text", "text": "Licensed under Apache License v2.0 with Runtime Library Exception." }
]
}
You can create a sloth using the init(name:color:power:) initializer.
Licensed under Apache License v2.0 with Runtime Library Exception.
mockup: the small block renders as its own paragraph, visually set off from surrounding
body text only by a reduced font size and a muted gray color — no border, background, or icon is
added. The wrapping <p> (from the dispatch case, not from Small.vue) supplies
standard paragraph block spacing above/below.
3. Data sheet
Source: Sources/DocCArchive/Vendored/RenderNode.spec.json, schema object
#/components/schemas/Small (lines 741–759), which is one arm of the
RenderBlockContent discriminated union (referenced at spec line 447). Cross-checked against
Components.Schemas.Small in Sources/DocCArchive/generated/Types.swift
(lines 4150–4175).
| Field | Type | Required | Enum values / default | Note |
|---|---|---|---|---|
type |
string | yes | "small" (single-value enum) |
Generated as a nested _TypePayload: String, Codable, Hashable, Sendable, CaseIterable { case small
= "small" }, decoded/encoded under the Swift property name _type via an explicit
CodingKeys entry (case _type = "type") — this kind discriminates on a wire
property literally named type, unlike some sibling block kinds (e.g. Row,
TabNavigator) that use kind instead. |
inlineContent |
array of RenderInlineContent |
yes | — (no minimum-count constraint in the wire schema) | Generated as [Components.Schemas.RenderInlineContent]. Only inline content is accepted here
— there is no nested block-content array field, matching the authoring-side restriction described in
Section 1's directive doc comment that @Small "does not support more structured markup". |
On the swift-docc production side (secondary/flavor source, not authoritative for wire shape), the enclosing
enum case is case small(Small)
(Sources/SwiftDocC/Model/Rendering/Content/RenderBlockContent.swift, line 69, doc comment: "A
paragraph of small print content that should be rendered in a small font"), and the nested struct is declared
at the same file, lines 819–822:
/// Small is based on HTML's `<small>` tag and could contain content like legal,
/// license, or copyright text.
public struct Small: Codable, Equatable {
/// The inline content that should be rendered.
public var inlineContent: [RenderInlineContent]
}
This matches the wire schema field-for-field (the Swift enum case name itself, small, supplies
the discriminator on encode/decode instead of a stored property). The authoring-side semantic model,
Sources/SwiftDocC/Semantics/Reference/Small.swift, is a separate type (a
Semantic/AutomaticDirectiveConvertible directive, not the render type above) whose
content property uses @ChildMarkup(numberOfParagraphs: .oneOrMore) (line 40), i.e.
authoring requires at least one paragraph of Markdown inside @Small { ... }. Its
render(with:) method (lines 64–80) is what actually produces the wire object shown above:
it first renders the directive's child markup normally into ordinary RenderBlockContent values,
then remaps every resulting .paragraph(paragraph) case into
.small(RenderBlockContent.Small(inlineContent: paragraph.inlineContent)), discarding the
paragraph wrapper and re-wrapping the same inline content as a small block. Any non-paragraph
block produced inside the directive body (e.g. a nested @Row) is passed through unchanged rather
than converted, which is also why swift-docc emits a
org.swift.docc.HasOnlyKnownDirectives diagnostic warning for structured markup inside
@Small (per SmallTests.swift's testEmitsWarningWhenContainsStructuredMarkup)
— the directive still renders such content, but not as a small block. An author produces
this kind by writing:
@Small {
_Licensed under Apache License v2.0 with Runtime Library Exception._
}
(directive doc comment, Small.swift lines 21–34; introduced in DocC version "5.8" per
introducedVersion, line 36).
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 small node
parsed via Components.Schemas.Small 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 small node, in context:
p— a plain, unclassed paragraph element, added by theContentNode.vuedispatch case itself (not bySmall.vue), so asmallblock always sits inside its own paragraph-level box in the flow layout.small— the native HTML element rendered bySmall.vue's template, with no extra class or id attribute; Vue's scoped-styles mechanism attaches its own generateddata-v-*attribute to this element instead, and the component's SCSS block targets the baresmalltag selector.- Inline children of
inlineContentnest inside the<small>exactly as they would inside a paragraph (e.g.code.code-voiceforcodeVoice,emforemphasis,strongforstrong), sincerenderChildrenis the same generic inline dispatcher used everywhere else.
SCSS: Small.vue carries its own scoped <style> block
(Small.vue#L23-L30),
which is the entirety of this kind's presentational styling:
small {
@include font-styles(body-reduced-tight);
color: var(--color-figure-gray);
}
font-styles(body-reduced-tight) resolves to a font-size/line-height pair of 14px/18px
at the "large" breakpoint (there is no separate "small"-breakpoint override for this style key), defined in
the shared typography map
(_font-styles.scss#L71-L73).
CSS custom property consumed: --color-figure-gray, defined per color scheme in
src/styles/core/colors/_light.scss (line 26) and its dark-mode counterpart — the same
token used for e.g. deprecated/experiment aside text, giving small print a muted-but-legible
gray rather than pure black/white body text color.
5. Modern CSS-only alternative
Not applicable
Current behavior in play: there is no interactive or stateful JS behavior to replace here.
Small.vue has no data(), no props, no computed properties, no event handlers, and
no conditional rendering — its <script> block is just
export default { name: 'Small' }. The ContentNode.vue dispatch case for
BlockType.small is likewise a single unconditional createElement call with no
branching. The entire visual effect (smaller font, gray color) is already achieved with plain, static CSS
applied to a plain, static HTML <small> element wrapped in a <p>.
Since this kind is stateless and has no interactive behavior, animation, or conditional visibility to
replace, none of the state-holding mechanisms this survey covers (<details>, radio +
:checked, :target, the Popover API, <dialog>, :has(),
container queries, anchor positioning, view transitions) apply — there is no state for them to hold.
A hand-authored static page could reproduce this kind's output today with nothing more than
<p><small>...</small></p> and a small { font-size: ...; color:
...; } rule, which is exactly what swift-docc-render already emits.