1. How swift-docc-render consumes this
article is one of two possible values of the top-level kind discriminator on a
DocumentationRenderNode (the other is "symbol"). It marks a standalone,
free-form documentation page — an "extension article" or top-level collection article written in a
.md file in a DocC catalog — as opposed to a page that documents a specific
symbol/declaration. Both share the exact same JSON schema and Vue rendering path; the difference is
only in which optional fields are populated (an article has no primaryContentSections
of kind declarations, for example).
Do not confuse this with views/Topic.vue's TopicKind.article.
swift-docc-render's route table
(src/routes.js)
sends any path starting with /documentation to
views/DocumentationTopic.vue,
which is the actual consumer of a DocumentationRenderNode — this is the kind described
on this page. Paths starting with /tutorials instead go to
views/Topic.vue, whose own, differently-scoped TopicKind.article constant
(src/views/Topic.vue#L37-L40)
dispatches to components/Article.vue, the renderer for tutorial "article" chapters
(hero/callToAction/assessments sections) that belong to a TutorialsPageRenderNode, a
completely different top-level schema variant. The two "articles" only share a wire-value string,
not a schema.
views/DocumentationTopic.vue wraps a single child, DocumentationLayout,
whose #content slot renders
components/DocumentationTopic.vue
(aliased as Topic in the view). This component takes the node's fields as flattened
props (role, roleHeading, title, abstract,
topicSections, etc. — see
props.role)
rather than switching on kind directly. It renders unconditionally for both
kind: "symbol" and kind: "article"; sections that don't apply to a plain
article (declarations, relationships, default implementations) are simply absent from the JSON and
so nothing renders for them — there is no v-if="kind === 'article'" branch.
The one place the render code visibly reacts to an article is via the finer-grained
metadata.role field (DocumentationRole enum, which also includes
"article" as one of its values, distinct from but usually aligned with the top-level
kind). role is passed straight through to
DocumentationHero.vue,
which uses it to pick the hero's icon and accent color:
// src/constants/TopicTypes.js
export const TopicTypes = { article: 'article', /* … */ };
// src/constants/HeroColors.js
export const HeroColorsMap = {
[TopicTypes.article]: HeroColors.teal,
/* … */
};
// src/components/TopicTypeIcon.vue
import ArticleIcon from 'theme/components/Icons/ArticleIcon.vue';
// … [TopicTypes.article]: ArticleIcon, …
so an article page gets a teal-tinted hero background and the dedicated
ArticleIcon
watermark, in contrast to a symbol page's kind-specific color (purple for struct, blue
for method, etc). metadata.roleHeading supplies the literal eyebrow text
above the title — for articles this is the plain string "Article", set on the swift-docc
side (see step 3 below), and swift-docc-render simply displays it verbatim via
Title's eyebrow prop.
On the swift-docc authoring side, a plain Markdown file in a DocC catalog (no @Tutorial
or @TutorialTableOfContents directive) is modeled as an Article semantic
node and translated by
RenderNodeTranslator.visitArticle
(Sources/SwiftDocC/Model/Rendering/RenderNodeTranslator.swift:624-625), which constructs
RenderNode(identifier: identifier, kind: .article) and then sets
node.metadata.role/roleHeading (lines 763-771, the latter hard-coding the
string "Article") — this is the origin of the JSON in step 2 below.
In this repository (DocCArchive), a parsed article node would arrive as the
.DocumentationRenderNode case of the generated RenderNode enum
(Components.Schemas.RenderNode, Sources/DocCArchive/generated/Types.swift:2883-2916)
with kind == .article. Turning it into HTML or Markdown output is not yet implemented:
MyHTMLTransformer and MyMarkdownTransformer
(Sources/DocCArchive/DocCArchive.swift:242-254) are still stub placeholders that ignore
the node's contents and return a hard-coded HTML comment / an empty string, respectively, regardless
of whether the node is a symbol or an article.
2. Example JSON and rendered mockup
Real fixture: Tests/DocCArchiveTests/Fixtures/ExampleDocs.doccarchive/data/documentation/exampledocs/examplearticle.json
in this repository (trimmed here to the fields relevant to kind/metadata/abstract
plus one representative content section).
{
"kind": "article",
"identifier": {
"interfaceLanguage": "swift",
"url": "doc://ExampleDocs/documentation/ExampleDocs/ExampleArticle"
},
"schemaVersion": { "major": 0, "minor": 3, "patch": 0 },
"metadata": {
"modules": [ { "name": "ExampleDocs" } ],
"role": "article",
"roleHeading": "Article",
"title": "ExampleArticle"
},
"hierarchy": {
"paths": [ [ "doc://ExampleDocs/documentation/ExampleDocs" ] ]
},
"abstract": [
{ "text": "An example article to display.", "type": "text" }
],
"primaryContentSections": [
{
"kind": "content",
"content": [
{ "type": "heading", "level": 2, "text": "Overview", "anchor": "Overview" },
{
"type": "paragraph",
"inlineContent": [
{ "type": "text", "text": "Description of what the article is about." }
]
}
]
}
],
"sections": [],
"references": {}
}
An example article to display.
Description of what the article is about.
3. Data sheet
Schema object: #/components/schemas/DocumentationRenderNode in
Sources/DocCArchive/Vendored/RenderNode.spec.json (line 2056), whose kind
property is {"type":"string","enum":["symbol","article"]} (line 2067-2070). Generated
Swift: Components.Schemas.DocumentationRenderNode with nested
KindPayload: String, Codable, Hashable, Sendable, CaseIterable enum
(Sources/DocCArchive/generated/Types.swift:5315-5322). On the swift-docc authoring side,
the top-level RenderNode.Kind enum (which backs both DocumentationRenderNode
and TutorialsPageRenderNode in swift-docc's own model) declares
case article at Sources/SwiftDocC/Model/Rendering/RenderNode.swift:255, decoded
from the literal string "article" at line 265.
| Field | Type | Required? | Enum values / default | Note |
|---|---|---|---|---|
kind | string | yes | "symbol" | "article" | Discriminator; "article" selects the standalone-article shape of this schema. |
identifier | ResolvedTopicReference | yes | — | Stable topic reference/URL for this page. |
schemaVersion | SchemaVersion | yes | — | major/minor/patch of the RenderNode schema itself. |
hierarchy | DocumentationHierarchy | yes | — | Breadcrumb path(s) from the module/root to this article. |
metadata | DocumentationMetadata | yes | — | Carries title, role (e.g. "article"), roleHeading (e.g. "Article"), modules. |
abstract | [RenderInlineContent] | no | — | Summary/dek shown under the title. |
primaryContentSections | [DocumentationPrimaryRenderSection] | no | — | Body content; for an article this is typically a single section of kind: "content" holding the Markdown body. |
topicSectionsStyle | string | no | list (default) | compactGrid | detailedGrid | hidden | Layout of the Topics/curation grid, if any. |
topicSections | [TasksGroupSection] | no | — | "Topics" curation groups the article links to. |
seeAlsoSections | [TasksGroupSection] | no | — | "See Also" groups. |
defaultImplementationsSections | [TasksGroupSection] | no | — | Not applicable to plain articles in practice (symbol-only), but present in the shared schema. |
relationshipsSections | [RelationshipsGroupSection] | no | — | Not applicable to plain articles in practice (symbol-only). |
sampleCodeDownload | SampleDownload | no | — | Download link, if the article is a sample-code landing page. |
deprecationSummary | [RenderBlockContent] | no | — | Deprecation notice content. |
diffAvailability | object (beta/minor/major/sdk) | no | — | API-diff availability metadata. |
sections | [RenderSection] | yes | — | Legacy/tutorial-style sections array; empty ([]) for ordinary articles in practice. |
references | object (map of RenderReference) | no | — | Resolved link/media/topic references cited elsewhere in the node. |
variants | [RenderNodeVariant] | no | — | JSON-Patch-style per-trait overrides (e.g. per-language). |
See also: variants & variantOverrides — the full trait-override mechanism behind this field — and The references map — how the references field above resolves.
Related but distinct enum: DocumentationRole (line 2447 of the same spec file) — the
value of metadata.role — includes "article" alongside "symbol",
"collection", "sampleCode", etc. It is a more granular classification than
the top-level kind and is what actually drives the hero color/icon choice in
swift-docc-render (see section 1).
4. HTML/CSS mapping in DocC-Render output
Root wrapper: <div class="doc-topic">
(src/components/DocumentationTopic.vue:13, styled in the component's own
<style scoped lang="scss"> block starting at line 752/796), shared verbatim by
symbol and article pages alike. Inside it:
<div class="documentation-hero">/documentation-hero__content/documentation-hero__above-content— fromsrc/components/DocumentationTopic/Hero/DocumentationHero.vue; its scoped SCSS defines the gradient background via the CSS custom properties--accent-colorand--standard-accent-color, which are set inline per-instance from the resolvedHeroColorsMapentry forrole: "article"(teal) and read by--color-documentation-intro-fill/--color-documentation-intro-accenttheme variables as fallbacks.<div class="icon">containing theArticleIconSVG watermark (background-iconclass), opacity/blend-mode controlled by$doc-hero-icon-opacity/$doc-hero-icon-effectSCSS variables in the same file.- The page title block uses the shared
Titlecomponent with aneyebrowprop set tometadata.roleHeading("Article"). - Body content (from
primaryContentSections) is rendered throughPrimaryContent/ContentNode.vue— the same block-content dispatch table used by every other block-content-bearing kind — so an article's headings, paragraphs, code listings, etc. get identical DOM/CSS to the corresponding content in a symbol page.
No article-specific SCSS file exists; all of the above is either inherited from the shared
DocumentationTopic.vue/DocumentationHero.vue styles or parameterized by the
role-driven color/icon lookup tables in src/constants/TopicTypes.js and
src/constants/HeroColors.js.
5. Modern CSS-only alternative
Not applicable
Current behavior: rendering an article-kind DocumentationRenderNode is a
one-shot server/build-time-to-DOM mapping with no client-side interactive state to hold. Vue
computes role/roleHeading/hero color from static JSON props once, on
mount, and there is no toggle, tab, disclosure, or other stateful widget anywhere in this rendering
path (contrast with something like a tab navigator, which holds currentTitle in
component data and swaps visible panels via v-show). Any interactivity a reader
encounters on an article page (a code-listing tab switcher, a disclosure triangle in a "Topics"
grid, etc.) belongs to a nested block/inline content kind, not to the article node
kind itself — those child kinds should be judged on their own reference pages. There is therefore no
single native HTML/CSS mechanism to "replace" here: the node kind itself is a static content
container, and a CSS-only alternative isn't a meaningful question for it.