CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-typedoc-plugin-markdown

A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown.

Pending
Overview
Eval results
Files

plugin-bootstrap.mddocs/

Plugin Bootstrap

Core plugin initialization that integrates with TypeDoc's application lifecycle, adding markdown output capabilities and comprehensive configuration options.

Capabilities

Load Function

The main plugin bootstrap function that integrates the plugin with TypeDoc's application system.

/**
 * The function that is called by TypeDoc to bootstrap the plugin.
 * Exposes additional TypeDoc options and makes adjustments for markdown output.
 * This method is not intended to be consumed in any other context than via the 'plugin' option.
 * @param app - The TypeDoc Application instance
 */
function load(app: Application): void;

Usage Example:

import { Application } from "typedoc";
import { load } from "typedoc-plugin-markdown";

// Initialize TypeDoc application
const app = new Application();

// Bootstrap the markdown plugin
load(app);

// The plugin is now loaded and ready to use
// Configure markdown output directory
app.options.setValue('markdown', './docs');

// Generate documentation
const project = app.converter.convert([
  app.expandInputFiles(['src/**/*.ts'])
]);

if (project) {
  await app.generateDocs(project, './docs');
}

Plugin Integration Process

The load() function performs three main bootstrap operations:

  1. Options Registration: Adds all plugin-specific configuration options to TypeDoc's options system
  2. Output Configuration: Registers the 'markdown' output format and sets it as default
  3. System Setup: Initializes the renderer and internationalization systems

Core Integration Steps:

// 1. Bootstrap options - adds all plugin declarations
Object.entries(declarations).forEach(([name, declaration]) => {
  app.options.addDeclaration({
    name,
    ...declaration,
  } as DeclarationOption);
});

// 2. Configure markdown outputs
app.outputs.addOutput('markdown', async (out, project) => {
  await render(app.renderer as MarkdownRenderer, project, out);
});

app.outputs.setDefaultOutputName('markdown');

// 3. Setup renderer and translations
setupRenderer(app);
setupInternationalization(app);

Option Declarations System

The plugin registers numerous configuration options through the declarations system.

/**
 * Plugin option declarations containing all configuration options
 * with their types, defaults, and validation rules
 */
const declarations: Record<string, DeclarationOption>;

Renderer Setup

Sets up the custom markdown renderer with enhanced capabilities.

/**
 * Sets up the custom markdown renderer with hooks and async job support
 * @param app - The TypeDoc Application instance
 */
function setupRenderer(app: Application): void;

Internationalization Setup

Configures internationalization support for the plugin.

/**
 * Sets up internationalization for the plugin with markdown-specific translations
 * @param app - The TypeDoc Application instance
 */
function setupInternationalization(app: Application): void;

Render Function

Core rendering function that processes TypeDoc projects into markdown documentation.

/**
 * Main render function that processes a TypeDoc project into markdown files
 * @param renderer - The markdown renderer instance
 * @param project - The TypeDoc project to render
 * @param outputDirectory - The directory to write markdown files to
 */
async function render(
  renderer: MarkdownRenderer, 
  project: ProjectReflection, 
  outputDirectory: string
): Promise<void>;

Integration with TypeDoc CLI:

# Using TypeDoc CLI with the plugin
typedoc --plugin typedoc-plugin-markdown --markdown ./docs src/**/*.ts

# Or using configuration file
typedoc --options typedoc.json

TypeDoc Configuration Example:

{
  "plugin": ["typedoc-plugin-markdown"],
  "markdown": "./docs",
  "entryPoints": ["src/**/*.ts"],
  "fileExtension": ".md",
  "hidePageHeader": true,
  "useCodeBlocks": true
}

Install with Tessl CLI

npx tessl i tessl/npm-typedoc-plugin-markdown

docs

configuration-options.md

events-hooks.md

index.md

plugin-bootstrap.md

routing-system.md

theme-system.md

tile.json