Configuration
Signature:
export interface Config
markdown link reference resolver
Signature:
linkReferencer?: ReferenceResolver;
markdown docs processor
Signature:
processor: MarkdownProcessor;
Content Builder
Signature:
export interface ContentBuilder
DeIndent content
Signature:
deindent(withoutNewLine?: boolean): void;
Parameters
Parameter | Type | Description |
---|---|---|
withoutNewLine | boolean | whether deindent to be added without new line |
Indent content
Signature:
indent(withoutNewLine?: boolean): void;
Parameters
Parameter | Type | Description |
---|---|---|
withoutNewLine | boolean |
Add line break
Signature:
newline(): void;
Parameters
Parameter | Type | Description |
---|
Add content
Signature:
push(content: string): void;
Parameters
Parameter | Type | Description |
---|---|---|
content | string | additional content |
Add content with line break
Signature:
pushline(content: string): void;
Parameters
Parameter | Type | Description |
---|---|---|
content | string | additional content |
Content
Signature:
readonly content: string;
Indent level
Signature:
readonly indentLevel: number;
Content Builder options
Signature:
export interface ContentBuilderOptions
options that creating a ContentBuilder
Intdent level of Builder
Signature:
indentLevel?: number;
Generate Options for Generate API
Signature:
export interface GenerateOptions
configration
Signature:
config: Config;
see the Config
generate done callback
Signature:
done?: (pkgname: string, filename: string) => void;
The callback that will be called when the generate process is finished.
TSDoc configration error callback
Signature:
errorOnTSDocConfig?: (error: string) => void;
The callback occurs if you have an error in configration when --tsdoc-config
is specified
generate style
Signature:
style: GenerateStyle;
see the GenerateStyle
TSDoc configration path
Signature:
tsdocConfigPath?: string;
Optional, see the here
Markdown content
Signature:
export interface MarkdownContent
mkarkdown content
Signature:
body: string;
markdown filename
Signature:
filename: string;
Create a Content Builder
Signature:
export declare function createContentBuilder(options?: ContentBuilderOptions): ContentBuilder;
Parameter | Type | Description |
---|---|---|
options | ContentBuilderOptions | Content Builder options |
A ContentBuilder instance
Escape text for markdown
Signature:
export declare function escapeText(text: string): string;
Parameter | Type | Description |
---|---|---|
text | string | the target text |
escaped text
Escape text for markdown table
Signature:
export declare function escapeTextForTable(text: string): string;
Parameter | Type | Description |
---|---|---|
text | string | the target text |
escaped text
Find custom tags
Signature:
export declare function findCustomTags(customBlocks: readonly DocBlock[], tag: string): DocBlock[];
Parameter | Type | Description |
---|---|---|
customBlocks | readonly DocBlock[] | target cusotm blocks |
tag | string | finding target tag |
found custom blocks
About custom tags, See the this issue
Generate API docs
Signature:
export declare function generate(input: string[], output: string, options: GenerateOptions): Promise<void>;
Parameter | Type | Description |
---|---|---|
input | string[] | input paths |
output | string | output api docs full path |
options | GenerateOptions | optiosn for generate, see the GenerateOptions |
Get DocSection content
Signature:
export declare function getDocSectionContent(model: ApiModel, pkg: ApiPackage, content: DocSection, contextItem: ApiItem, style: GenerateStyle, resolver: ReferenceResolver, customTags: string[]): string;
Parameter | Type | Description |
---|---|---|
model | ApiModel | a model |
pkg | ApiPackage | a package |
content | DocSection | a content |
contextItem | ApiItem | a context item |
style | GenerateStyle | generate style, See the GenerateStyle |
resolver | ReferenceResolver | resolver to resolve markdown content references |
customTags | string[] |
doc section markdown content
Get safe path from display name of ApiItem
Signature:
export declare function getSafePathFromDisplayName(name: string): string;
Parameter | Type | Description |
---|---|---|
name | string | the target displayname |
safe path
Process of API doc model
Signature:
export declare function process(model: ApiModel, pkg: ApiPackage, style: GenerateStyle, resolver: ReferenceResolver, customTags?: string[]): string | MarkdownContent[];
Parameter | Type | Description |
---|---|---|
model | ApiModel | a model |
pkg | ApiPackage | a package |
style | GenerateStyle | generate style, See the GenerateStyle |
resolver | ReferenceResolver | resolver to resolve markdown content references |
customTags | string[] | TSDoc custom tags. This parameter is set to an array of custom tag names defined in --tsdoc-config . |
markdown content strign or Array of MarkdownContent
Generate the markdown contents the bellow:
- Function
- Enum
- Interface
- Class
- Variable
- TypeAlias
Resolve the markdown content reference
Signature:
export declare function resolve(style: GenerateStyle, item: ApiItem, model: ApiModel, pkg: ApiPackage, customTags?: string[]): string;
Parameter | Type | Description |
---|---|---|
style | GenerateStyle | generate style, See the GenerateStyle |
item | ApiItem | a item |
model | ApiModel | a model |
pkg | ApiPackage | a package |
customTags | string[] | TSDoc custom tags. This parameter is set to an array of custom tag names defined in --tsdoc-config . |
resolved the reference string
This reference resolver is used by the processor to generate API docs references for separate pieces of markdown content.
Process of API doc model
Signature:
export declare function process(model: ApiModel, pkg: ApiPackage, style: GenerateStyle, resolver: ReferenceResolver, customTags?: string[]): string | MarkdownContent[];
Parameter | Type | Description |
---|---|---|
model | ApiModel | a model |
pkg | ApiPackage | a package |
style | GenerateStyle | generate style, See the GenerateStyle |
resolver | ReferenceResolver | resolver to resolve markdown content references |
customTags | string[] | TSDoc custom tags. This parameter is set to an array of custom tag names defined in --tsdoc-config . |
markdown string content that have TOC
Generate the markdown contents that have TOC. About API doc model, see the doc model structure, and doc model API. In about generate api docs, see the api-docs-gen API References
Resolve the markdown content reference
Signature:
export declare function resolve(style: GenerateStyle, item: ApiItem, model: ApiModel, pkg: ApiPackage, customTags?: string[]): string;
Parameter | Type | Description |
---|---|---|
style | GenerateStyle | generate style, See the GenerateStyle |
item | ApiItem | a item |
model | ApiModel | a model |
pkg | ApiPackage | a package |
customTags | string[] | TSDoc custom tags. This parameter is set to an array of custom tag names defined in --tsdoc-config . |
resolved the reference string
This reference resolver is used by the processor to generate a reference specifically for API docs of markdown content with TOC.
Default Configration
Signature:
DefaultConfig: Config
Default config for the CLI
The generate style
Signature:
export declare const enum GenerateStyle
Member | Value | Description |
---|---|---|
Directory | "directory" | Output api docs files for each package |
NoPrefix | "noprefix" | No Prefix the output api docs file name |
Prefix | "prefix" | Prefix the output api docs file name with package name |
The value of this constants is the same as that taken from --genereate-style
option.
Markdown docs processor
Signature:
export declare type MarkdownProcessor = (model: ApiModel, pkg: ApiPackage, style: GenerateStyle, resolver: ReferenceResolver, customTags?: string[]) => string | MarkdownContent[];
Markdown reference resolver
Signature:
export declare type ReferenceResolver = (style: GenerateStyle, item: ApiItem, model: ApiModel, pkg: ApiPackage, customTags?: string[]) => string;