A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown.
—
Core plugin initialization that integrates with TypeDoc's application lifecycle, adding markdown output capabilities and comprehensive configuration options.
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');
}The load() function performs three main bootstrap operations:
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);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>;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;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;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.jsonTypeDoc 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