Structure
RenderNode
A rendering-friendly representation of a documentation node.
struct RenderNode
Mentioned In
Discussion
A render node contains all the data required for a renderer to display a topic’s documentation. This includes the topic’s authored markup documentation, hierarchy information (the topic’s curation), API availability, and more.
The fields of a render node are populated depending on the documentation page’s type. For example, reference documentation pages (i.e., symbols and articles) have their child topics listed in topicSections, but for Tutorial pages, that field is empty.
Information about external resources such as other documentation pages or media is stored in the references dictionary.
An OpenAPI specification for render node is available in the repo at Sources/SwiftDocC/SwiftDocC.docc/Resources/RenderNode.spec.json.
Versioning
The render node schema constantly evolves to support new documentation features. To help clients maintain compatibility, we associate each schema with a version. See schemaVersion for more details.
Variants
Different variants of a documentation page can be represented by a single render node using the variantOverrides property. This property holds overrides that clients should apply to the render JSON when processing documentation for specific programming languages. The overrides are organized by traits (e.g., language) and it’s up to the client to determine which trait is most appropriate for them. For example, a client that wants to process the Objective-C version of documentation should apply the overrides associated with the interfaceLanguage: objc trait.
Use the makeEncoder(prettyPrint:emitVariantOverrides:assetPrefixComponent:) API to instantiate a JSON encoder that’s configured to accumulate variant overrides and emit them to the variantOverrides property.
The overrides are emitted in the JSON Patch format.
To apply variants onto a render node using SwiftDocC, use the RenderNodeVariantOverridesApplier API.
Topics
General
Reference Documentation Data
Data specific for reference documentation nodes.
Multi-Language Reference Documentation Data
Data specific for reference documentation nodes that are available in multiple programming languages.
Sample Code Data
Data specific for sample code nodes.
Models
Structures
Initializers
Instance Properties
Instance Methods
Type Methods
Enumerations