Reads API Extractor JSON files and generates API documentation in various output formats
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Enhanced TSDoc node system that extends the standard TSDoc markup with specialized elements for rich documentation. These custom nodes enable advanced formatting and structure in generated documentation.
Enumeration defining all available custom doc node types.
enum CustomDocNodeKind {
EmphasisSpan = 'EmphasisSpan',
Heading = 'Heading',
NoteBox = 'NoteBox',
Table = 'Table',
TableCell = 'TableCell',
TableRow = 'TableRow'
}TSDoc configuration class that registers custom node definitions for parsing and rendering.
class CustomDocNodes {
/**
* Gets the TSDoc configuration with custom nodes registered
* @returns Configured TSDocConfiguration instance
*/
static get configuration(): TSDocConfiguration;
}Usage Example:
import { CustomDocNodes } from "@microsoft/api-documenter/lib/nodes/CustomDocNodes";
import { TSDocParser } from "@microsoft/tsdoc";
// Use custom nodes configuration
const parser = new TSDocParser(CustomDocNodes.configuration);Custom heading element with configurable title and level for structured documentation.
class DocHeading extends DocNode {
/**
* The heading text content
*/
readonly title: string;
/**
* The heading level (1-5, where 1 is largest)
*/
readonly level: number;
/**
* Creates a new DocHeading instance
* @param parameters - Heading configuration parameters
*/
constructor(parameters: IDocHeadingParameters);
}
interface IDocHeadingParameters {
/**
* Configuration for the DocNode base class
*/
configuration: TSDocConfiguration;
/**
* The heading text content
*/
title: string;
/**
* The heading level (1-5, where 1 is largest)
*/
level: number;
}Usage Example:
const heading = new DocHeading({
configuration: CustomDocNodes.configuration,
title: "API Reference",
level: 2
});Custom callout container for highlighting important information, warnings, or tips in documentation.
class DocNoteBox extends DocNode {
/**
* Creates a new DocNoteBox instance
* @param parameters - Note box configuration parameters
*/
constructor(parameters: IDocNoteBoxParameters);
}
interface IDocNoteBoxParameters {
/**
* Configuration for the DocNode base class
*/
configuration: TSDocConfiguration;
/**
* The content inside the note box
*/
content: DocNode[];
}Usage Example:
const noteBox = new DocNoteBox({
configuration: CustomDocNodes.configuration,
content: [
new DocPlainText({
configuration: CustomDocNodes.configuration,
text: "Important: This API is experimental and may change."
})
]
});Custom table container for structured tabular data in documentation.
class DocTable extends DocNode {
/**
* Creates a new DocTable instance
* @param parameters - Table configuration parameters
*/
constructor(parameters: IDocTableParameters);
/**
* Creates a new table row and adds it to the table
* @returns New DocTableRow instance
*/
createAndAddRow(): DocTableRow;
}
interface IDocTableParameters {
/**
* Configuration for the DocNode base class
*/
configuration: TSDocConfiguration;
/**
* Optional table header row
*/
headerRow?: DocTableRow;
/**
* Array of table rows
*/
rows?: DocTableRow[];
}Table row container that holds table cells.
class DocTableRow extends DocNode {
/**
* Creates a new DocTableRow instance
* @param parameters - Table row configuration parameters
*/
constructor(parameters: IDocTableRowParameters);
/**
* Creates a new table cell and adds it to the row
* @returns New DocTableCell instance
*/
createAndAddCell(): DocTableCell;
}
interface IDocTableRowParameters {
/**
* Configuration for the DocNode base class
*/
configuration: TSDocConfiguration;
/**
* Array of table cells in this row
*/
cells?: DocTableCell[];
}Individual table cell containing content.
class DocTableCell extends DocNode {
/**
* Creates a new DocTableCell instance
* @param parameters - Table cell configuration parameters
*/
constructor(parameters: IDocTableCellParameters);
}
interface IDocTableCellParameters {
/**
* Configuration for the DocNode base class
*/
configuration: TSDocConfiguration;
/**
* Content inside the table cell
*/
content: DocNode[];
}Table Usage Example:
import { DocTable, DocTableRow, DocTableCell, DocPlainText } from "@microsoft/api-documenter";
// Create table
const table = new DocTable({
configuration: CustomDocNodes.configuration
});
// Add header row
const headerRow = table.createAndAddRow();
const nameHeader = headerRow.createAndAddCell();
nameHeader.appendNode(new DocPlainText({
configuration: CustomDocNodes.configuration,
text: "Parameter"
}));
const typeHeader = headerRow.createAndAddCell();
typeHeader.appendNode(new DocPlainText({
configuration: CustomDocNodes.configuration,
text: "Type"
}));
// Add data row
const dataRow = table.createAndAddRow();
const nameCell = dataRow.createAndAddCell();
nameCell.appendNode(new DocPlainText({
configuration: CustomDocNodes.configuration,
text: "options"
}));
const typeCell = dataRow.createAndAddCell();
typeCell.appendNode(new DocPlainText({
configuration: CustomDocNodes.configuration,
text: "ConfigOptions"
}));Custom emphasis element for inline text styling and highlighting.
class DocEmphasisSpan extends DocNode {
/**
* Creates a new DocEmphasisSpan instance
* @param parameters - Emphasis span configuration parameters
*/
constructor(parameters: IDocEmphasisSpanParameters);
}
interface IDocEmphasisSpanParameters {
/**
* Configuration for the DocNode base class
*/
configuration: TSDocConfiguration;
/**
* Whether the emphasis should be bold formatting
*/
bold?: boolean;
/**
* Whether the emphasis should be italic formatting
*/
italic?: boolean;
/**
* Content inside the emphasis span
*/
content: DocNode[];
}Usage Example:
const emphasis = new DocEmphasisSpan({
configuration: CustomDocNodes.configuration,
bold: true,
italic: false,
content: [
new DocPlainText({
configuration: CustomDocNodes.configuration,
text: "Important Note"
})
]
});Custom doc nodes integrate with the markdown emitter system for proper rendering:
import { CustomMarkdownEmitter } from "@microsoft/api-documenter/lib/markdown/CustomMarkdownEmitter";
import { DocHeading, DocTable } from "@microsoft/api-documenter";
class EnhancedMarkdownEmitter extends CustomMarkdownEmitter {
protected writeHeading(docHeading: DocHeading): void {
// Custom heading rendering
const level = Math.min(docHeading.level, 6);
this.writeNewline();
this.writePlainText('#'.repeat(level) + ' ' + docHeading.title);
this.writeNewline();
}
protected writeTable(docTable: DocTable): void {
// Custom table rendering with enhanced formatting
this.writeNewline();
this.writePlainText('| Column 1 | Column 2 |');
this.writeNewline();
this.writePlainText('|----------|----------|');
// ... render table rows
this.writeNewline();
}
}Custom nodes work seamlessly with TSDoc parsing and can be used in API documentation comments:
/**
* Process configuration options for the API.
*
* @customHeading Configuration Structure
*
* @customTable
* | Property | Type | Description |
* |----------|------|-------------|
* | timeout | number | Request timeout in ms |
* | retries | number | Maximum retry attempts |
*
* @customNote
* This API is available in version 2.0 and later.
*
* @param options - Configuration object
* @returns Promise resolving to processed result
*/
function processConfig(options: ConfigOptions): Promise<ProcessResult>;Custom doc nodes provide validation and error handling: