1. How swift-docc-render consumes this
Grepping src/components/ for the literal string 'aside' lands on
src/components/ContentNode.vue's wire-constant table
(ContentNode.vue#L37-L54),
whose first entry is BlockType.aside = 'aside'. That constant is matched in the module-level
render(node) function's switch (node.type) dispatch table
(the function itself starts at
ContentNode.vue#L259),
and aside is the very first case arm:
case BlockType.aside: {
const props = { kind: node.style, name: node.name };
return createElement(Aside, { props }, (
renderChildren(node.content)
));
}
(ContentNode.vue#L261-L266.)
Two wire fields are forwarded as props to a dedicated child component: node.style becomes the
component's kind prop, and node.name becomes its name prop. The
node's content array (nested RenderBlockContent children, e.g. paragraphs) is
recursively rendered via the same module's renderChildren() helper and passed as the default
slot—so an aside can contain arbitrary block content, not just text. The child component,
Aside, is imported at
ContentNode.vue#L13
from
src/components/ContentNode/Aside.vue.
The same BlockType.aside constant is also matched by two internal tree-walking utilities
exposed on ContentNode—map()
(ContentNode.vue#L554-L558)
and forEach()
(ContentNode.vue#L616-L618)—both
of which recurse into node.content so that aside bodies participate in generic content-tree
traversal (used elsewhere for things like building a plaintext summary; a code comment at
ContentNode.vue#L678
notes that asides are still ignored by the specific plaintext computed property, which only
unwraps paragraphs).
Aside.vue's entire template is a single native <aside> element:
<aside :class="kind" :aria-label="kind">
<p class="label">{{ name || $t(label) }}</p>
<slot />
</aside>
(Aside.vue#L11-L16.)
The kind prop drives both the CSS class (:class="kind", e.g. class="note")
and the accessible label (aria-label="kind"), and is validated against a fixed local
Kind map—deprecated, experiment, important,
note, tip, warning—via a Vue prop validator
(Aside.vue#L19-L44).
The visible label text is name if supplied by the wire payload, otherwise it falls back to a
localized string looked up as aside-kind.<kind> via
$t(label) (label is a computed property:
label: ({ kind }) => \`aside-kind.${kind}\`). The English locale file defines display strings
for note, tip, experiment, important,
warning, deprecated—and also beta
(en-US.json#L78-L86)—but
that beta entry appears to be vestigial for this component: nothing in
src/components/ passes kind="beta" to Aside, and the string
"beta" elsewhere in the render app is used only for the unrelated availability
<Badge variant="beta"> component (API-change/deprecation badges), not for aside styling.
See also: Localization fallback — how $t()/locale-key lookup works across every kind that uses it.
2. Example JSON and rendered mockup
A real fixture comes from swift-docc's own test suite,
Tests/SwiftDocCTests/Rendering/RenderBlockContent+AsideTests.swift
(creatingSupportedAside(name:), lines 92–109), which decodes exactly this shape of
RenderBlockContent JSON for each DocC-Render-supported style. The example below is that literal
fixture body (style "note") embedded, for page context, inside a minimal enclosing
content array the way it would appear inside a RenderNode's
primaryContentSections.
{
"type": "aside",
"style": "note",
"name": "Note",
"content": [
{
"type": "paragraph",
"inlineContent": [
{ "type": "text", "text": "This is a test paragraph" }
]
}
]
}
mockup: a bordered callout box with a thicker leading (left, in LTR) edge, a bold label line
reading the aside's name, and its nested block content (here, one paragraph) below the label. The
border/background/label colors vary by style (see Section 4); note, as shown
here, uses the neutral gray palette.
3. Data sheet
Source: Sources/DocCArchive/Vendored/RenderNode.spec.json, schema object
#/components/schemas/Aside (lines 714–740), one arm of the RenderBlockContent
discriminated union (referenced at spec line 444). Cross-checked against
Components.Schemas.Aside in Sources/DocCArchive/generated/Types.swift
(lines 4102–4148).
| Field | Type | Required | Enum values / default | Note |
|---|---|---|---|---|
type |
string | yes | "aside" (single-value enum) |
Discriminator. Generated as _TypePayload, decoded/encoded as Swift property
_type via CodingKeys { case _type = "type" }. |
style |
string | yes | "important" | "note" | "tip" | "warning" | "experiment" |
Generated as Aside.StylePayload: String, Codable, Hashable, Sendable, CaseIterable with
exactly those five cases. Notably the wire schema's enum has only five values—it does
not list "deprecated", even though swift-docc-render's Aside.vue
component (Section 1) accepts deprecated as a sixth valid kind and styles it with
its own orange palette (Section 4). This is a real discrepancy between the JSON Schema/OpenAPI spec vendored
in this repo and the actual render-side component; treat the schema's five-value enum as aspirational/stale
for this one style rather than a hard ceiling on what DocC-Render can display. |
name |
string | no | — | Optional display label shown in the aside's header line. Maps directly to the name prop on
Aside.vue; if absent, the render component falls back to a localized string keyed off
style (Section 1). |
content |
array of RenderBlockContent |
yes | — | Nested block content shown inside the aside body. Recursive: an aside's content array can itself contain another aside, a code listing, a list, etc. |
The generated Swift struct mirrors the schema exactly:
public struct Aside: Codable, Hashable, Sendable {
public enum _TypePayload: String, Codable, Hashable, Sendable, CaseIterable {
case aside = "aside"
}
public var _type: Aside._TypePayload
public enum StylePayload: String, Codable, Hashable, Sendable, CaseIterable {
case important = "important"
case note = "note"
case tip = "tip"
case warning = "warning"
case experiment = "experiment"
}
public var style: Aside.StylePayload
public var name: Swift.String?
public var content: [Components.Schemas.RenderBlockContent]
public enum CodingKeys: String, CodingKey {
case _type = "type"
case style
case name
case content
}
}
On the swift-docc production side (secondary/flavor source, not authoritative for wire shape), the enclosing
enum case wraps a dedicated payload struct: case aside(Aside)
(Sources/SwiftDocC/Model/Rendering/Content/RenderBlockContent.swift, line 43—the pinned
swiftCaseSite—with doc comment "An aside block."), whose struct is defined at line 107
(the pinned swiftStructSite): public struct Aside: Codable, Equatable { public var style:
AsideStyle; public var name: String; public var content: [RenderBlockContent] }. Unlike the wire
schema, swift-docc's authoring-side name is non-optional (always populated, defaulting to the
capitalized style name if the author didn't specify one—see the several init overloads at
lines 118–191). The authoring-side AsideStyle type (struct, not enum; defined at lines
602–673) is deliberately permissive on input but normalizes on output: its
init(rawValue:) lowercases the value and, per its own doc comment, "if the lowercased raw value
doesn't match one of the aside styles supported by DocC Render (one of note, tip, experiment, important, or
warning) the new aside style's raw value will be set to note" (lines 625–628, 632–636). This is
confirmed by the real swift-docc test fixture cited in Section 2's sibling file
(RenderBlockContent+AsideTests.swift): an aside authored/decoded with style "custom"
has its style coerced to "note" while its name is preserved verbatim
(lines 360–407), and a style/name mismatch (e.g. style: "tip", name:
"Important") is retained as-is rather than reconciled (lines 410–434). Notably, this coercion
means "deprecated" passed as a raw style string on the authoring side would also be
normalized down to "note" by AsideStyle—so the deprecated CSS
class visible in Aside.vue/Section 4 is reachable by DocC-Render's JSON schema/consumer code but
is not something swift-docc's own RenderBlockContent.Aside APIs currently know how to produce
through the paths exercised in that test file.
What an author writes: DocC (via swift-markdown) recognizes a small set of Markdown blockquote-style aside
markers—> Note:, > Warning:, > Tip:,
> Important:, > Experiment:—which compile into a
RenderBlockContent.aside(_:) node via the Aside(asideKind:content:) initializer
(lines 161–191), keyed off Markdown.Aside.Kind's raw value. No dedicated .docc
catalog authoring article for asides/callouts was found under
Sources/SwiftDocC/SwiftDocC.docc/ in this checkout; the syntax is documented primarily through
these Swift doc comments and swift-markdown's own Aside markup type rather than a standalone
narrative page.
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 an aside node
parsed via Components.Schemas.Aside 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 an aside node, in context (from Aside.vue's template):
aside.<kind>— the root element, a native<aside>tag, with its CSS class set dynamically to thekindvalue (e.g.aside.note,aside.warning) andaria-labelmirroring the same string.p.label— the first child, always present, holding the display name (either the wirenamefield or the localized fallback forkind).- (default slot) — the aside's nested block content (paragraphs, lists, code listings, etc.), rendered by the same generic block-content pipeline as top-level content.
SCSS: Aside.vue carries its own scoped <style> block
(Aside.vue#L47-L85):
aside {
break-inside: avoid;
border-radius: var(--aside-border-radius, $border-radius);
border-style: var(--aside-border-style, solid);
border-block-width: var(--aside-border-width-block, $aside-width-border);
border-inline-width: var(--aside-border-width-inline,
$aside-width-left-border
$aside-width-border);
padding: rem(16px);
text-align: start;
.label {
@include font-styles(documentation-aside-name);
& + * { margin-top: var(--spacing-stacked-margin-small); }
}
@each $kind in $aside-kinds {
&.#{$kind} {
background-color: var(--color-aside-#{$kind}-background);
border-color: var(--color-aside-#{$kind}-border);
box-shadow: 0 0 $aside-width-border 0px var(--color-aside-#{$kind}-border) inset,
0 0 $aside-width-border 0px var(--color-aside-#{$kind}-border);
.label { color: var(--color-aside-#{$kind}); }
}
}
}
break-inside: avoid keeps an aside from splitting across a print/paginated column break.
$aside-width-border (0px) and $aside-width-left-border
(6px), both defaulted with Sass's !default, come from
_vars.scss#L64-L65:
they combine with the logical border-inline-width/border-block-width properties so
the box has no border on the block edges (top/bottom) but a 6px border on the inline-start edge (left, in
LTR)—that's the "thicker leading edge" seen in the mockup. The @each $kind in $aside-kinds
loop ($aside-kinds: deprecated, experiment, important, note, tip, warning, line 50) generates one
rule per style, each pulling its background/border/label colors from a matching triplet of CSS custom
properties.
CSS custom properties consumed, one triplet per style (defined for the light theme at
_light.scss#L38-L55
and mirrored as generated Swift constants in
Sources/DocCArchive/generated/Types.swift lines 8264–8281,
e.g. case asideNoteBackground = "aside-note-background"):
--color-aside-deprecated/-background/-border— figure-gray text on an orange-secondary fill with an orange border (the one style visually distinct from the note/tip/important/experiment group, and, per Section 3, not present in the wire schema'sstyleenum).--color-aside-warning/-background/-border— figure-gray text on a red-secondary fill with a red border.--color-aside-note,--color-aside-tip,--color-aside-important,--color-aside-experiment(each with matching-background/-bordersuffixes) — all four resolve to the same neutral gray-secondary fill with a light-gray border, i.e. these four styles are visually identical apart from their label text.
The label text itself uses the documentation-aside-name font-style token (17px/26px,
semibold), defined in
_font-styles.scss#L147-L149
and applied via the shared @include font-styles(...) mixin.
5. Modern CSS-only alternative
Not applicable
Current behavior in play: none that involves JavaScript state or runtime interactivity.
Aside.vue has no data(), no event handlers, and no conditional rendering beyond a
prop validator and a computed fallback-label string
(label: ({ kind }) => \`aside-kind.${kind}\`); the component is a pure, one-shot mapping from
three inputs (kind, optional name, slotted children) to a single styled
<aside> element (Section 1). The Vue dispatch in ContentNode.vue
(case BlockType.aside: ... createElement(Aside, { props }, renderChildren(node.content))) is
likewise a static, one-time transform at render time—it makes no runtime decision based on user
interaction, scroll position, viewport size, or any other changeable state; it just forwards two string
props and recursively renders the nested content tree once.
There is nothing here analogous to the tab-selection state, disclosure toggling, or scroll-linked behavior
that other kinds' Vue components hold in JS (compare a tab navigator's currentTitle or a
disclosure group's open/closed flag). An aside node's only "behavior" is variant styling picked
by a fixed string (style) that is baked into the class list at render time and never changes
afterward for a given node instance; a modern-CSS-only version would look exactly like the current output
(a bordered, colored callout box with a label paragraph), because there is no interactive or stateful
mechanism in the original to replace with :checked, :target, <details>,
or any other state-holding CSS selector.