inline

strikethrough

Wire value: "strikethrough"

Appears on: Documentation Topic, Tutorial (Project), Tutorial Article

1. How swift-docc-render consumes this

Grepping src/components/ for the literal string 'strikethrough' finds the same wire-constant table used by every block/inline kind on this reference site, src/components/ContentNode.vue's InlineType map (ContentNode.vue#L56-L69):

const InlineType = {
  codeVoice: 'codeVoice',
  emphasis: 'emphasis',
  image: 'image',
  inlineHead: 'inlineHead',
  link: 'link',
  newTerm: 'newTerm',
  reference: 'reference',
  strong: 'strong',
  text: 'text',
  superscript: 'superscript',
  subscript: 'subscript',
  strikethrough: 'strikethrough',
};

Unlike newTerm or inlineHead (which fall through to the same branch as another kind), strikethrough gets its own case in the renderNode() factory function's switch (node.type) dispatch table, and delegates to a dedicated Vue component rather than a bare native element (ContentNode.vue#L503-L504):

case InlineType.strikethrough:
  return createElement(StrikeThrough, renderChildren(node.inlineContent));

StrikeThrough is imported at the top of the file from ./ContentNode/StrikeThrough.vue (ContentNode.vue#L24). That component's entire template is a native <s> element wrapping a <slot />, with two accessibility-only data-* attributes carrying localized strings for screen readers (StrikeThrough.vue#L11-L17):

<s
  :data-before-text="$t('accessibility.strike.start')"
  :data-after-text="$t('accessibility.strike.end')">
    <slot />
</s>

Those localization keys resolve (in the English locale bundle, src/lang/locales/en-US.json) to "start of stricken text" and "end of stricken text". The component's scoped <style> block turns those two attribute values into generated ::before/::after pseudo-element content via content: attr(data-before-text) / attr(data-after-text), then visually hides both with the shared visuallyhidden() SCSS mixin — so a sighted reader sees only the struck-through text, while a screen reader announces "start of stricken text…end of stricken text" around it. The node's only payload field, inlineContent (an array of nested RenderInlineContent items), is recursively rendered through the same module-local renderChildren helper used by every other inline wrapper kind (ContentNode.vue#L122-L124).

ContentNode.vue's tree-walking utility API (map, forEach) also explicitly lists InlineType.strikethrough alongside emphasis, strong, inlineHead, superscript, subscript, and newTerm as a "wrapper" kind whose inlineContent array must be recursed into when walking a content tree without rendering it — for example when building a plain-text abstract for search indexing (ContentNode.vue#L564-L575, ContentNode.vue#L619-L628). No other .vue file under src/components/ or src/views/ matches the literal string 'strikethrough' as a RenderNode-kind handler. (A separate, unrelated strikethrough CSS class exists in src/components/ContentNode/CodeListing.vue, used to mark a highlighted code-listing line as user-deleted diff content — that is a distinct feature keyed on syntax-highlighting diff metadata, not on a RenderInlineContent node, and is not discussed further here.)

See also: Localization fallback — how $t()/locale-key lookup works across every kind that uses it.

2. Example JSON and rendered mockup

No real fixture containing a strikethrough RenderInlineContent node was found in Tests/DocCArchiveTests/Fixtures/ (the two .doccarchive bundles) or in Tests/SwiftDocCTests/ in the swift-docc checkout at this pin — the only hits in either test tree are a Swift unit test that constructs the case directly in memory (RenderBlockContent+CapitalizationTests.swift, testRenderInlineContentStrikethrough()) rather than a JSON fixture on disk. The example below is therefore hand-written.

{
  "type": "paragraph",
  "inlineContent": [
    {
      "type": "text",
      "text": "This API is "
    },
    {
      "type": "strikethrough",
      "inlineContent": [
        {
          "type": "text",
          "text": "deprecated"
        }
      ]
    },
    {
      "type": "text",
      "text": " removed."
    }
  ]
}

This API is deprecated removed.

3. Data sheet

Field table for the Strikethrough schema object in Sources/DocCArchive/Vendored/RenderNode.spec.json (lines 1432–1452 of the vendored copy), cross-checked against the generated Components.Schemas.Strikethrough struct in Sources/DocCArchive/generated/Types.swift (lines 1954–1980):

FieldTypeRequired?Enum values / defaultNote
typestringyes"strikethrough"Discriminator. Generated as Strikethrough._TypePayload, a String-backed enum with exactly one case.
inlineContentarray of RenderInlineContentyes—The nested inline-content children to be struck through; generated as [Components.Schemas.RenderInlineContent]. Structurally identical in shape to Emphasis.inlineContent, Strong.inlineContent, Superscript.inlineContent, and Subscript.inlineContent.

A schema-authority discrepancy worth flagging plainly: the Strikethrough object is defined as its own top-level schema entry in RenderNode.spec.json, but at this pinned commit it is not listed among the oneOf members of the RenderInlineContent discriminator schema. That oneOf array enumerates exactly eleven refs — Text, Emphasis, Strong, CodeVoice, Reference, Image, InlineHead, NewTerm, Superscript, Link, and Subscript — and Strikethrough is absent from it, even though sibling wrapper kinds Superscript and Subscript are present. Grepping the whole vendored spec file for the literal string "Strikethrough" turns up only the one schema definition itself; it is never $ref'd from anywhere. This looks like an omission in the vendored JSON Schema rather than an intentional exclusion, since swift-docc's own Swift-side RenderInlineContent enum (see below) does include a strikethrough case in its Codable round-trip, and swift-docc-render's own InlineType constant table (Step 1, above) treats it as a first-class sibling of superscript/subscript. Practically, this means a JSON-Schema-driven consumer that validates strictly against RenderInlineContent's oneOf could reject a wire-valid strikethrough node as non-conforming, even though every actual producer and consumer in the swift-docc toolchain treats it as valid; the OpenAPI-generated Swift types in this repository still expose a usable Components.Schemas.Strikethrough struct because it was generated as its own named schema component, independent of whether the RenderInlineContent oneOf list references it.

On the authoring side, swift-docc's in-memory RenderInlineContent Swift enum case at RenderInlineContent.swift#L56 is case strikethrough(inlineContent: [RenderInlineContent]), documented with the doc comment "A strikethrough piece of content." — brief, but as with its sibling cases the doc comment supplies no further semantics beyond the name. This case is produced by RenderContentCompiler.visitStrikethrough(_:) (RenderContentCompiler.swift#L358-L360), which visits a swift-markdown Strikethrough markup AST node (the GitHub-Flavored-Markdown ~~text~~ syntax, as parsed by swift-markdown's cmark-gfm extension) and reduces its children into the inlineContent array. So the author-facing syntax that produces this RenderNode kind is ordinary Markdown double-tilde strikethrough, e.g. ~~deprecated~~, written directly in a DocC comment or article — there is no dedicated directive for it. Unlike newTerm, this compiler path is real and reachable, not dormant.

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 strikethrough node parsed via Archive.parseRenderNode(dataPath:) would decode correctly into Components.Schemas.RenderInlineContent.Strikethrough but is not yet converted to any output format.

4. HTML/CSS mapping in DocC-Render output

The rendered output is a native <s>...</s> element (via the dedicated StrikeThrough.vue component, not a bare createElement('s', ...) call inline in ContentNode.vue) carrying two data-* attributes:

The component carries no class or id of its own; styling is scoped entirely to the bare s element selector inside StrikeThrough.vue's own <style scoped lang="scss"> block (StrikeThrough.vue#L24-L38), which imports the shared docc-render/styles/_core.scss partial for its @include visuallyhidden() mixin (defined in src/styles/core/_helpers.scss). That mixin clips the generated ::before/ ::after pseudo-element content to a 1px box off-screen (via clip-path: inset(...), height: 1px, width: 1px, overflow: hidden) so it is readable only by assistive technology. No CSS custom property (--* variable) is consumed by this component; the visible strikethrough line itself is produced entirely by the browser's user-agent default rendering of the <s> element (text-decoration-line: line-through), not by any DocC-render SCSS declaration.

5. Modern CSS-only alternative

Not applicable

Current behavior, precisely: a strikethrough node is rendered by StrikeThrough.vue as a static native <s> element wrapping its recursively-rendered children, with two data-* attributes populated once at render time from i18n strings and consumed only by generated ::before/::after pseudo-element content for screen-reader announcement text. There is no Vue data, no reactive prop, no event handler, and no client-side state of any kind attached to this component or its rendering path — it renders once from its inlineContent prop and never changes. The "behavior" in play is simply the native semantics of <s> (the browser's default text-decoration-line: line-through) plus a static accessibility affordance, which is already the plain, non-interactive, CSS/HTML-only mechanism in use today — there is nothing toggleable, hidden, or otherwise stateful for a native CSS mechanism such as <details>/<summary>, a radio-input :checked pattern, :target, the Popover API, <dialog>, or :has() to replace.