1. How swift-docc-render consumes this
Grepping src/components/ for the literal string 'newTerm' lands, as with every
other block/inline content kind on this reference site, on src/components/ContentNode.vue's
wire-constant table. newTerm is one of the entries in the InlineType map
(ContentNode.vue#L56-L69):
const InlineType = {
codeVoice: 'codeVoice',
emphasis: 'emphasis',
image: 'image',
inlineHead: 'inlineHead',
link: 'link',
newTerm: 'newTerm',
...
};
That constant is matched in the renderNode() factory function's switch (node.type)
dispatch table, where newTerm falls through to the same case as emphasis
— there is no dedicated branch, dedicated Vue component, or distinct DOM output for
newTerm at all:
case InlineType.emphasis:
case InlineType.newTerm:
return createElement('em', (
renderChildren(node.inlineContent)
));
(ContentNode.vue#L437-L441.)
A newTerm node is turned directly into a bare native <em> element via Vue's
createElement, exactly as an emphasis node would be. The node's only payload
field, inlineContent (an array of nested RenderInlineContent nodes), is
recursively rendered through the same module-local renderChildren helper
(ContentNode.vue#L122-L124)
used by every other inline/block wrapper kind. The type discriminator itself is consumed only
by the switch and never forwarded into the DOM, so a rendered page has no way to distinguish
a newTerm span from an emphasis span after the fact — both are indistinguishable
<em> elements.
ContentNode.vue also has a tree-walking utility API (map, forEach,
reduce) used elsewhere in the app to traverse a content tree without rendering it (for
example, to build the plain-text abstract for search indexing or social-preview metadata). Both
map and forEach explicitly list InlineType.newTerm alongside
emphasis, strong, inlineHead, superscript,
subscript, and strikethrough as "wrapper" kinds whose inlineContent
array must be recursed into
(ContentNode.vue#L564-L575,
ContentNode.vue#L619-L628).
No other .vue file under src/components/ or src/views/ matches the
literal string 'newTerm' — there is no glossary panel, tooltip, or definition-popover
component anywhere in swift-docc-render that treats a "new term" specially. Despite the name
suggesting a glossary-style feature (a defined term a reader might hover or tap for a definition), the
render side treats it purely as a synonym for italic emphasis.
2. Example JSON and rendered mockup
Real fixture, from swift-docc's test suite:
Tests/SwiftDocCTests/Rendering/Rendering Fixtures/custom-render-elements.json (lines 74–108),
pinned at swift-docc@8b8d8268aa. This excerpt is a paragraph's inlineContent array
containing plain text, a newTerm node, more text, and a sibling inlineHead node
(kept here to show newTerm alongside another rare inline wrapper kind):
{
"type": "paragraph",
"inlineContent": [
{
"type": "text",
"text": "Use "
},
{
"type": "newTerm",
"inlineContent": [
{
"type": "text",
"text": "www"
}
]
},
{
"type": "text",
"text": " and "
},
{
"type": "inlineHead",
"inlineContent": [
{
"type": "text",
"text": "ftp"
}
]
},
{
"type": "text",
"text": "."
}
]
}
Use www and ftp.
3. Data sheet
Field table for the NewTerm schema object
(Sources/DocCArchive/Vendored/RenderNode.spec.json, one of the eleven members of the
RenderInlineContent oneOf discriminator), cross-checked against the generated
Components.Schemas.NewTerm struct in Sources/DocCArchive/generated/Types.swift:
| Field | Type | Required? | Enum values / default | Note |
|---|---|---|---|---|
type | string | yes | "newTerm" | Discriminator. Generated as NewTerm._TypePayload, a String-backed enum with exactly one case (RenderNode.spec.json lines 1377–1381 of the vendored copy). Unlike Emphasis, there is no alternate/legacy spelling accepted on the wire. |
inlineContent | array of RenderInlineContent | yes | — | The nested inline-content children considered "the term"; generated as [Components.Schemas.RenderInlineContent]. Structurally identical in shape to Emphasis.inlineContent and Strong.inlineContent — the schema carries no extra metadata (no definition text, no glossary identifier, no cross-reference) that would let a consumer distinguish "this is a defined term" from "this is merely italicized." |
Note the asymmetry with swift-docc's authoring-side Swift model: the in-memory RenderInlineContent
Swift enum case at
RenderInlineContent.swift#L48
is case newTerm(inlineContent: [RenderInlineContent]), documented only as "A piece of content
that introduces a new term" — the doc comment gives no further semantics. Searching swift-docc's
Markdown-to-render-tree compiler (Sources/SwiftDocC/Model/Rendering/RenderContentCompiler.swift)
for a constructor of this case found none: there is no visitNewTerm-style visitor, and DocC's
term-list block syntax (a Markdown definition list, compiled by
RenderTermLists.swift)
builds its TermListItem.Term from plain inlineContent, not a newTerm
wrapper. The only places .newTerm(...) is constructed in the swift-docc repository at this
pin are test fixtures
(InlineContentPlainTextTests.swift,
RenderBlockContent+CapitalizationTests.swift)
plus the plain-text/indexing extension
(RenderInlineContent+TextIndexing.swift#L44).
Honestly stated: this reference could not find an authoring-side Markdown or directive syntax in the
current swift-docc checkout that produces a newTerm node; the case, the JSON Schema entry, and
the render-side handling all exist and are wired together, but the compiler path from author-written text to
this case appears to be unused/reserved at this pinned commit.
Within this repository, DocCArchive does not yet implement any transform logic keyed on
RenderInlineContent case at all: MyHTMLTransformer and
MyMarkdownTransformer (Sources/DocCArchive/DocCArchive.swift) are still
stub/placeholder implementations of the Transformer protocol — the former returns a
hardcoded HTML comment and the latter an empty string — so a newTerm node parsed via
Archive.parseRenderNode(dataPath:) would decode correctly into
Components.Schemas.RenderInlineContent.NewTerm but is not yet converted to any output format.
4. HTML/CSS mapping in DocC-Render output
The rendered output is a bare <em>...</em> element with no id,
class, or data-* attribute of its own — the same
createElement('em', renderChildren(node.inlineContent)) call used for emphasis
(ContentNode.vue#L438-L441)
passes no class/attrs object at all, unlike sibling cases such as
InlineType.codeVoice (which adds class: 'inline-code') or
InlineType.reference (which adds class: 'inline-link') a few lines away in the
same switch. No SCSS file under src/styles/ targets a newTerm-specific
class, and grepping the stylesheet tree for new-term or newTerm turns up nothing.
The italic appearance is produced entirely by the browser's built-in default style for the
<em> element (user-agent stylesheet font-style: italic), not by any
DocC-render-authored CSS class or custom property — there is no visual signal in the shipped output
that would let a reader tell a "new term" apart from ordinary emphasized text.
5. Modern CSS-only alternative
Not applicable
Current behavior, precisely: newTerm nodes are rendered as a plain, static <em>
element via the identical one-line createElement('em', renderChildren(...)) call used for
emphasis, with no Vue data, no props, no event handlers, and no client-side state of
any kind attached to the element or its rendering path. There is nothing dynamic to reproduce: the "behavior"
in play is simply the HTML semantics of <em> (stress emphasis) combined with the browser's
default font-style: italic presentation, which is already the plain, non-JavaScript,
non-interactive mechanism in use today. Because the wire schema also carries no glossary identifier,
definition text, or cross-reference field (see the data sheet above), there is no latent "tooltip" or
"definition popover" feature being suppressed by CSS limitations either — the payload simply does not
contain the information such a feature would need. There is no toggleable, hidden, or otherwise stateful
aspect of this kind for a native CSS mechanism (<details>/<summary>,
:target, the Popover API, :has(), etc.) to replace.