plugins/theme/index.mjs) registers a custom Markdown theme called doc-kit. It is composed of three layers: the theme class, a set of helpers, and a set of partials.
Theme classes
DocKitTheme extends MarkdownTheme from typedoc-plugin-markdown. Its getRenderContext override sets a handful of global options on every render pass and returns a DocKitThemeContext instance.
DocKitThemeContext extends MarkdownThemeContext and replaces the helpers and partials properties with the custom implementations described below.
Registration
Theload function registers the theme with the renderer under the name "doc-kit". This name must match the theme option in generate-md.mjs.
Helpers
Helpers are utility functions available onctx.helpers throughout the theme. The custom helpers are merged on top of the base MarkdownThemeContext helpers so all built-in helpers remain available.
typedListItem({ label, name, type, comment })
typedListItem({ label, name, type, comment })
Renders a single entry in a typed list as a Markdown list item.
Output format:
| Parameter | Type | Description |
|---|---|---|
label | string | A plain-text label (e.g. "Returns"). Takes priority over name. |
name | string | A symbol name, rendered in backticks if label is absent. |
type | SomeType | string | The TypeDoc type or a raw string. Rendered via ctx.partials.someType for objects. |
comment | Comment | CommentTag | Provides the description text via comment.summary or comment.content. |
* Returns: {string} The compiled output pathtypedList(entries)
typedList(entries)
Maps an array of typed-list entries through This function is also assigned to several partials (
typedListItem and joins them with newlines.parametersList, typedParametersList, typeDeclarationList, propertiesTable) so that parameters and properties are consistently rendered as typed lists.renderExamples(comment, headingLevel)
renderExamples(comment, headingLevel)
Finds all
@example block tags in a comment and renders each one as a headed section. Returns null when there are no examples.- If there is more than one
@exampletag, headings are numbered (Example 1,Example 2, …). - The heading level is one deeper than the surrounding section (
headingLevel + 1). - Tags with empty bodies are silently omitted.
stabilityBlockquote(comment)
stabilityBlockquote(comment)
Inspects a comment for stability-related JSDoc tags and returns a Markdown blockquote, or
null if none are present. Only the first matching stability level is rendered.| Tag | Output |
|---|---|
@deprecated | > Stability: 0 - Deprecated[: message] |
@experimental or @beta | > Stability: 1 - Experimental |
@legacy | > Stability: 3 - Legacy[: message] |
@deprecated and @legacy include the tag’s content as a trailing message when present. @experimental/@beta are modifier tags and carry no content.Partials
Partials are template fragments available onctx.partials. Custom partials are merged on top of the base MarkdownThemeContext partials and the type partials from partials/types.mjs.
signature(model, options)
signature(model, options)
Renders a complete function signature block in the following order:
- Stability blockquote — emitted if the comment carries a stability tag.
- Type parameter list — rendered when
model.typeParametersis non-empty. - Parameter list — rendered when
model.parametersis non-empty. - Return type — always present; falls back to
"void"whenmodel.typeis absent. - Comment body — rendered without tags (
showTags: false). - Examples — rendered via
renderExamples.
options.multipleSignatures is true, only the signature’s own comment is used. Otherwise the parent reflection’s comment is used as a fallback.memberTitle(model)
memberTitle(model)
Returns the Markdown title string for a class member. The format depends on the reflection kind:Kind prefix table:
- Constructor —
`new ClassName([param1][, param2])` - Method / function — prefixed with the kind label (e.g.
Static method:) followed by`name(params)` - Property / accessor / other — prefixed with the kind label (e.g.
Class:) followed by`name`
, (or [, ] for optional ones).| Kind | isStatic | Prefix |
|---|---|---|
Class | — | Class: |
Interface | — | Interface: |
Enum | — | Enum: |
TypeAlias | — | Type: |
Namespace | — | Namespace: |
Accessor | — | Accessor: |
Method | true | Static method: |
| All others | — | (no prefix) |
constructor(model, options)
constructor(model, options)
Renders all overload signatures of a constructor. For each signature it emits:
- A heading at
options.headingLevelshowing`new ClassName(params)`. - The signature body via
ctx.partials.signatureatheadingLevel + 1.
Type partials (partials/types.mjs)
partials/types.mjs provides the someType function and a full set of per-kind type renderers. All of them are spread directly into the partials object via ...typePartials in partials/index.mjs.
someType(model)
The central type resolver. Accepts a TypeDoc SomeType and returns a {type} string wrapped in curly braces. It calls an internal resolve function that handles every TypeDoc type kind:
| Type kind | Output |
|---|---|
intrinsic, reference | {TypeName} |
literal (string) | {"value"} (JSON-encoded) |
literal (other) | {value} |
array | {ElementType[]} |
tuple | {A|B|...} (union of elements) |
union, intersection | {A|B|...} |
optional, indexedAccess | delegates to element/object type |
query | delegates to query type |
typeOperator | delegates to target type |
conditional | {TrueType|FalseType} |
named-tuple-member | delegates to element type |
reflection | {object} |
inferred, unknown | {unknown} |
declarationType | {object} (special-cased export) |
functionType | {Function} (special-cased export) |
Named exports
All of the following are aliases ofsomeType (they delegate to the same resolver):
arrayType, conditionalType, indexAccessType, inferredType, intersectionType, intrinsicType, literalType, namedTupleType, optionalType, queryType, referenceType, reflectionType, tupleType, typeOperatorType, unionType, unknownType
Two special-case exports override the default resolver:
declarationType— always returns"{object}"regardless of content.functionType— always returns"{Function}"regardless of content.
partials/types.mjs
Stability levels
ThestabilityBlockquote helper maps JSDoc tags to stability levels modelled on the Node.js stability index.
| Level | Tag | Blockquote rendered |
|---|---|---|
| 0 | @deprecated | > Stability: 0 - Deprecated[: message] |
| 1 | @experimental or @beta | > Stability: 1 - Experimental |
| 3 | @legacy | > Stability: 3 - Legacy[: message] |
Levels are checked in the order shown above. If a symbol is tagged with both
@deprecated and @legacy, the @deprecated level (0) takes precedence.