builddocs
Version:
Generate HTML documentation from TypeScript types and doc comments
60 lines (59 loc) • 1.82 kB
TypeScript
export type Content = Text | Seq | Delim | Break | Ref<any>;
declare class Text {
text: string;
attrs: Record<string, string>;
constructor(text: string, attrs?: Record<string, string>);
get length(): number;
}
declare class Seq {
parts: Content[];
length: number;
constructor(parts: Content[]);
}
declare class Break {
parts: Content[];
length: number;
constructor(parts: Content[]);
}
declare class Delim {
open: Content;
close: Content;
inner: Content[];
length: number;
mustBreak: boolean;
constructor(open: Content, close: Content, inner: Content[], mustBreak: boolean);
}
declare class Ref<T> {
content: T;
constructor(content: T);
get length(): number;
}
export declare function seq(...content: Content[]): Seq;
export declare function seqA(content: Content[]): Seq;
export declare function maybeBreak(content: Content[]): Break;
export declare function delim(open: Content, inner: Content[], close: Content, mustBreak?: boolean): Delim;
export declare function text(text: string, attrs?: Record<string, string>): Text;
export declare function ref<T>(value: T): Ref<T>;
export declare const space: Text;
export declare const nbsp: Text;
export declare function sep(parts: Content[], separator?: string): Content[];
declare class Line {
text: readonly Text[];
textLength: number;
addIndent: number;
extraIndent: number;
length: number;
indent: number;
space: boolean;
constructor(text: readonly Text[], addIndent: number, textLength?: number, extraIndent?: number, space?: boolean);
render(): string;
}
type Layout = Line[];
export declare function format(content: Content, width: number, indentUnit?: number): {
layout: Layout;
refs: {
ref: any;
line: number;
}[];
};
export {};