1. How swift-docc-render consumes this
symbol is one of the two possible values of the top-level kind
discriminator on a documentation-reference render node (the other is "article").
Unlike block/inline content kinds — which are dispatched inside
ContentNode.vue's renderNode() lookup table — this is a
node-tier discriminator, and swift-docc-render does not actually branch on its literal
string value anywhere in the Vue layer. There is no if (node.kind === 'symbol') or
component-lookup table keyed on "symbol" in the render app.
Instead, both kind: "symbol" and kind: "article" render nodes are routed
to the same Vue Router view,
src/views/DocumentationTopic.vue, which wraps the shared
src/components/DocumentationTopic.vue component. That component's
extractProps(json) method destructures the raw RenderNode JSON directly — it never
reads json.kind at all. It instead reads discriminating sub-fields from
json.metadata (role, symbolKind) and from
json.primaryContentSections to decide what to show:
// src/components/DocumentationTopic.vue, extractProps(json)
const {
...
metadata: {
conformance,
...
role,
symbolKind = '',
remoteSource,
...
} = {},
primaryContentSections,
relationshipsSections,
...
} = json;
See
extractProps, lines 619-705. A page produced from a symbol render node
typically has metadata.role === "symbol" (or a related role such as
containerSymbol, restRequestSymbol, or dictionarySymbol —
see the data sheet below), a non-empty metadata.symbolKind (e.g. "property",
"class", "func"), and a primaryContentSections array whose
first section is usually kind: "declarations". An article-kind node
instead has metadata.role === "article", no symbolKind, and no
declarations section — the same template conditionally renders (or omits) the
Declaration, RequirementMetadata, and other symbol-specific
sub-components based on the presence of that data, rather than on kind itself. This
is visible in the template guards:
<div v-if="declarations.length" class="declarations-container" ...>
<Declaration v-for="(declaration, index) in declarations" ... />
</div>
...
<RequirementMetadata v-if="isRequirement" ... />
(lines 75-108).
The root template element for the whole page is
<div class="doc-topic">
(lines 12-15).
Note: src/constants/TopicTypes.js also defines a string constant
symbol: 'symbol', but that is an unrelated, narrower concept — a topic-reference
"role" tag used by cross-reference link rendering (e.g. in
ContentNode/Reference.vue and Navigator.vue) to decide whether a
reference to a symbol should be styled with inline code formatting. It is not the
top-level RenderNode kind discriminator documented on this page, and should not be
confused with it.
DocCArchive's own transform layer does not yet do anything with this kind: both
MyHTMLTransformer.convert(node:) and MyMarkdownTransformer.convert(node:)
in Sources/DocCArchive/DocCArchive.swift are still stub placeholders (the former
returns a hardcoded <!-- what? --> comment, the latter returns an empty
string) regardless of whether node.kind is .symbol or anything else, so
a symbol render node parsed via Archive.parseRenderNode(dataPath:)
would decode correctly into Components.Schemas.RenderNode but produce no real
HTML/Markdown output today.
2. Example JSON and rendered mockup
Real fixture: Tests/DocCArchiveTests/Fixtures/SampleLibrary.doccarchive/data/documentation/samplelibrary/samplestruct/score.json
in this repository — a minimal instance-property symbol page (trimmed here to the fields
relevant to this page; the full fixture also carries a small references dictionary).
{
"kind": "symbol",
"identifier": {
"interfaceLanguage": "swift",
"url": "doc://SampleLibrary/documentation/SampleLibrary/SampleStruct/score"
},
"metadata": {
"externalID": "s:13SampleLibrary0A6StructV5scoreSdvp",
"fragments": [
{ "kind": "keyword", "text": "let" },
{ "kind": "text", "text": " " },
{ "kind": "identifier", "text": "score" },
{ "kind": "text", "text": ": " },
{ "kind": "typeIdentifier", "preciseIdentifier": "s:Sd", "text": "Double" }
],
"modules": [ { "name": "SampleLibrary" } ],
"role": "symbol",
"roleHeading": "Instance Property",
"symbolKind": "property",
"title": "score"
},
"primaryContentSections": [
{
"kind": "declarations",
"declarations": [
{
"languages": ["swift"],
"platforms": ["macOS"],
"tokens": [
{ "kind": "keyword", "text": "let" },
{ "kind": "text", "text": " " },
{ "kind": "identifier", "text": "score" },
{ "kind": "text", "text": ": " },
{ "kind": "typeIdentifier", "preciseIdentifier": "s:Sd", "text": "Double" }
]
}
]
}
],
"hierarchy": {
"paths": [
[
"doc://SampleLibrary/documentation/SampleLibrary",
"doc://SampleLibrary/documentation/SampleLibrary/SampleStruct"
]
]
},
"schemaVersion": { "major": 0, "minor": 3, "patch": 0 },
"sections": [],
"variants": [
{
"paths": ["/documentation/samplelibrary/samplestruct/score"],
"traits": [ { "interfaceLanguage": "swift" } ]
}
]
}
Instance Property
let score: Double
SampleLibrary › SampleStruct › score
3. Data sheet
Authoritative schema object: DocumentationRenderNode in
Sources/DocCArchive/Vendored/RenderNode.spec.json (the sibling schema
TutorialsPageRenderNode handles the overview/project/article-in-tutorials
cases and is out of scope for this page). RenderNode itself is defined as
oneOf [TutorialsPageRenderNode, DocumentationRenderNode].
Cross-checked against the generated
Components.Schemas.DocumentationRenderNode struct in
Sources/DocCArchive/generated/Types.swift (starting at line 5315), which matches the
JSON schema field-for-field.
| Field | Type | Required | Enum values / default | Note |
|---|---|---|---|---|
kind | string | yes | "symbol" | "article" | Discriminator for this schema object; this page covers the "symbol" case. |
identifier | ResolvedTopicReference | yes | — | Contains interfaceLanguage and the url (a doc:// URL). |
schemaVersion | SchemaVersion | yes | — | major/minor/patch of the render-JSON schema. |
hierarchy | DocumentationHierarchy | yes | — | Breadcrumb path(s) from module root to this node. |
metadata | DocumentationMetadata | yes | — | See sub-table below; carries role, symbolKind, title, etc. |
sections | array of RenderSection | yes | — | Generic tutorial-style sections; typically empty for symbol pages (see example). |
primaryContentSections | array of DocumentationPrimaryRenderSection | no | — | Declarations, discussion, parameters, etc. First entry is usually kind: "declarations" for a symbol. |
references | map<string, RenderReference> | no | — | Keyed by doc:// identifier; resolves links/cross-references used elsewhere in the node. |
abstract | array of RenderInlineContent | no | — | Summary/abstract line shown under the title. |
topicSectionsStyle | string | no | list | compactGrid | detailedGrid | hidden, default list | Layout style for the Topics section. |
topicSections | array of TasksGroupSection | no | — | Curated child-topic groups. |
seeAlsoSections | array of TasksGroupSection | no | — | "See Also" groups. |
defaultImplementationsSections | array of TasksGroupSection | no | — | Protocol default-implementation links. |
relationshipsSections | array of RelationshipsGroupSection | no | — | Conforms-to / inherits-from etc. |
sampleCodeDownload | SampleDownload | no | — | Download link for associated sample project. |
downloadNotAvailableSummary | array of RenderBlockContent | no | — | Shown when a sample download is unavailable. |
deprecationSummary | array of RenderBlockContent | no | — | Deprecation notice content. |
diffAvailability | object (beta/minor/major/sdk → DiffAvailabilityInfo) | no | — | API-diff badges relative to other versions. |
variants | array of RenderNodeVariant | no | — | Per-language/trait path variants for this node. |
variantOverrides | array of VariantOverride | no | — | JSON-Patch overrides applied per trait (e.g. Objective-C variant). |
Selected metadata (DocumentationMetadata) fields:
| Field | Type | Required | Enum values / default | Note |
|---|---|---|---|---|
title | string | yes | — | Page title, e.g. "score". |
role | DocumentationRole (string) | no | symbol | containerSymbol | restRequestSymbol | dictionarySymbol | pseudoSymbol | pseudoCollection | collection | collectionGroup | article | sampleCode | overview | table | codeListing | link | project | subsection | task | The practical discriminator swift-docc-render actually branches on (not kind). |
symbolKind | SymbolKind (plain string, no enum constraint in the schema) | no | e.g. property, class, func, struct | Drives roleHeading logic and conditionals like "is this a module page" in DocumentationTopic.vue. |
roleHeading | string | no | — | Human-readable kind label, e.g. "Instance Property". |
required | boolean | no | — | Marks a protocol-requirement symbol. |
externalID | string | no | — | Compiler/USR-style symbol identifier. |
fragments | array of DeclarationToken | no | — | Inline "signature" tokens shown in navigator/links. |
modules | array of DocumentationMetadataModule | no | — | Owning module name(s). |
platforms | array of PlatformAvailability | no | — | Per-platform availability/deprecation/beta info. |
conformance | ConformanceSection | no | — | "Available when ... conforms to ..." constraint text. |
See also: variants & variantOverrides — the full trait-override mechanism behind the two fields in the table above.
See also: The references map — how this and every other reference-dictionary lookup works across kinds.
4. HTML/CSS mapping in DocC-Render output
The whole page renders inside a single root element,
<div class="doc-topic">, produced by
src/components/DocumentationTopic.vue. Notable descendant hooks used by both
symbol and article pages:
#app-main/.main— the<main>(or<div>under IDE targets) wrapper..doc-content-wrapper>.doc-content— the primary content column..declarations-container— wraps one or more<Declaration>components; only rendered whenprimaryContentSectionscontains adeclarationssection (i.e., normally only forkind: "symbol")..description— wraps deprecation/download-unavailable<Aside>blocks and the abstract-adjacent content..container— wrapsPrimaryContent(declarations/discussion/parameters/etc.)..declaration-list-menu/.declaration-list-toggle— the "Show/Hide other declarations" control for multi-platform declarations.
All SCSS for this component is co-located in a <style scoped lang="scss">
block inside DocumentationTopic.vue itself (no separate .scss
partial) — see roughly
lines 796-1008.
CSS custom properties consumed/set there include --doc-hero-right-offset,
--spacing-stacked-margin-large, --spacing-stacked-margin-xlarge,
--declaration-code-listing-margin,
--declaration-conditional-constraints-margin,
--declaration-source-link-margin, --code-block-style-elements-padding,
--aside-border-radius, --code-border-radius,
--content-table-title-border-width, and the shared theme tokens
--colors-link / --color-link and --colors-grid /
--color-grid. Child components (Declaration.vue,
PrimaryContent.vue, Topics.vue, Relationships.vue,
SeeAlso.vue, DefaultImplementations.vue) each carry their own
scoped styles that this page does not enumerate in full.
5. Modern CSS-only alternative
NOT APPLICABLE
The symbol node kind is not itself an interactive widget — it is a data-format
discriminator that tells the renderer "build a reference-documentation page, and this page has
declarations/availability/symbol metadata." The current JS/Vue behavior in play at this level is
plain conditional template rendering: DocumentationTopic.vue uses ordinary Vue
v-if directives (v-if="declarations.length",
v-if="isRequirement", v-if="primaryContentSectionsSanitized &&
primaryContentSectionsSanitized.length", etc., lines 75-165) driven by which optional
fields are present in the JSON payload. There is no client-side interactive state here (no
toggle/tab/expand/collapse behavior gated on kind or role itself) for a
CSS mechanism to replace — the one truly stateful, click-driven widget on the page,
the "Show/Hide other declarations" toggle (toggleDeclList/declListExpanded,
lines 706-708 and 118-128), belongs to the declarations
primary-content-section kind, not to the symbol node kind itself, and should be
assessed on that section's own reference page rather than here. At the node-kind level, the
right characterization is simply: pick-one-of-two-templates-at-build-time based on a string
field, which is inherently a server/build-time concern, not something a browser-side CSS
selector could hold state for.