banira
    Preparing search index...

    Class DocGen

    A class for parsing and rendering TSDoc documentation comments. Provides functionality to parse TypeScript source files and extract their documentation, as well as render the documentation in a formatted way.

    Index

    Constructors

    Properties

    customConfiguration: TSDocConfiguration = ...

    The TSDoc configuration used for parsing and rendering documentation.

    tagName: string
    tsdocParser: TSDocParser

    The TSDoc parser used for parsing documentation comments.

    CUSTOM_BLOCK_DEFINITION_DEMO: TSDocTagDefinition = ...

    TSDoc tag definition for demo blocks. This custom block tag allows marking code sections as demos in the documentation.

    WEB_COMPONENT_BLOCK_DEFINITIONS: TSDocTagDefinition[] = ...

    TSDoc tag definitions for the web-component documentation tags (@slot, @csspart, @cssprop, @fires). Registering them as block tags keeps their text out of the summary section — their content is rendered in the API reference tables from the manifest instead.

    Accessors

    • get src(): string

      The component module src used in the generated page (configurable via options).

      Returns string

    Methods

    • Parameters

      • sourceCode: string

      Returns ParserContext

    • Produces a complete documentation page for a component: the TSDoc summary and @demo blocks combined with a full API reference (attributes, properties, events, slots, CSS parts and CSS custom properties) derived from the Custom Elements Manifest.

      Parameters

      • file: string

        Path to the TypeScript source file to document

      • Optionaldeclaration: CustomElementDeclaration

        Optional pre-built manifest declaration; pass it when one is already available (e.g. when documenting a whole library) to avoid re-running the manifest analysis for this file

      Returns Promise<string>

      A complete HTML document as a string

    • Builds the Custom Elements Manifest declaration for a source file, preferring the one whose tag name matches this generator's tag.

      Parameters

      • file: string

        Path to the TypeScript source file

      Returns CustomElementDeclaration | undefined

      The matching declaration, or undefined if none is found

    • Parses a TypeScript source file to extract its documentation.

      Parameters

      • doc: string

        The path to the TypeScript source file to parse

      Returns Promise<ParserContext>

      A Promise that resolves to a ParserContext containing the parsed documentation

    • Renders a parsed documentation context to a standalone HTML doc page. The page includes the summary description, any @demo blocks (shown both live and as source), and documented @param attributes.

      Parameters

      Returns string

      A complete HTML document as a string

      Error if the context or docComment is undefined