> ## Documentation Index
> Fetch the complete documentation index at: https://mint-tsdocs.saulo.engineer/llms.txt
> Use this file to discover all available pages before exploring further.

# CustomMarkdownEmitter class

> Custom markdown emitter that extends the base MarkdownEmitter to provide Mintlify-specific formatting and cross-reference resolution. This emitter converts TSDoc tables into Mintlify components (ParamField, ResponseField, TypeTree) for better documentation UX. It also handles API reference resolution with caching for performance. \#\# Architecture The emission process follows this flow: 1. TSDoc nodes are traversed recursively via writeNode() 2. Tables are detected and classified by their header content 3. Property tables → TypeTree components with nested object support 4. Method/Constructor tables → ResponseField components 5. Other tables → HTML table fallback \#\# Security Considerations All user content is sanitized through SecurityUtils before being embedded in JSX/MDX: - sanitizeJsxAttribute() - For JSX attribute values (prevents quote escape attacks) - sanitizeJsonForJsx() - For JSON data embedded in JSX props - getEscapedText() - For markdown content (prevents markdown injection) Note: Content injection (XSS, template injection) is NOT a threat because users generate documentation from their own code for their own sites. Security focus is on command injection and path traversal (see CLAUDE.md). \#\# Caching Strategy API reference resolution is cached via ApiResolutionCache (LRU cache) to avoid repeated expensive lookups during documentation generation. Cache is ephemeral (per-run) and does not persist across builds.

export const RefLink = ({target, children}) => {
  if (!target || typeof target !== 'string') {
    console.error('RefLink: Invalid target prop. Expected non-empty string.');
    return <span className="tsdocs-reflink broken-link" title="Invalid RefLink target" data-component="tsdocs-reflink">Invalid Link</span>;
  }
  const linkText = children || target;
  const path = typeof window !== 'undefined' && window.getRefPath ? window.getRefPath(target) : `./${target.split('.').filter(s => s.length > 0).join('/')}`;
  const isValid = typeof window !== 'undefined' && window.VALID_REFS && window.VALID_REFS.has(target);
  const className = !isValid ? 'tsdocs-reflink broken-link' : 'tsdocs-reflink';
  const title = !isValid ? `Broken API reference: ${target}` : undefined;
  return <a href={path} className={className} title={title} data-component="tsdocs-reflink">
      {linkText}
    </a>;
};

export const PageLink = ({target, children}) => {
  if (!target || typeof target !== 'string') {
    console.error('PageLink: Invalid target prop. Expected non-empty string.');
    return <span className="tsdocs-pagelink broken-link" title="Invalid PageLink target" data-component="tsdocs-pagelink">Invalid Link</span>;
  }
  const linkText = children || target;
  let path = target;
  if (!path.startsWith('/')) {
    path = `/${target}`;
  }
  const isValid = typeof window !== 'undefined' && window.VALID_PAGES && window.VALID_PAGES.has(target);
  const className = !isValid ? 'tsdocs-pagelink broken-link' : 'tsdocs-pagelink';
  const title = !isValid ? `Broken page link: ${target}` : undefined;
  return <a href={path} className={className} title={title} data-component="tsdocs-pagelink">
      {linkText}
    </a>;
};

# CustomMarkdownEmitter

## Summary

Custom markdown emitter that extends the base MarkdownEmitter to provide Mintlify-specific formatting and cross-reference resolution.  This emitter converts TSDoc tables into Mintlify components (ParamField, ResponseField, TypeTree) for better documentation UX. It also handles API reference resolution with caching for performance.  ## Architecture  The emission process follows this flow: 1. TSDoc nodes are traversed recursively via `writeNode()` 2. Tables are detected and classified by their header content 3. Property tables → TypeTree components with nested object support 4. Method/Constructor tables → ResponseField components 5. Other tables → HTML table fallback  ## Security Considerations  All user content is sanitized through SecurityUtils before being embedded in JSX/MDX: - `sanitizeJsxAttribute()` - For JSX attribute values (prevents quote escape attacks) - `sanitizeJsonForJsx()` - For JSON data embedded in JSX props - `getEscapedText()` - For markdown content (prevents markdown injection)  Note: Content injection (XSS, template injection) is NOT a threat because users generate documentation from their own code for their own sites. Security focus is on command injection and path traversal (see CLAUDE.md).  ## Caching Strategy  API reference resolution is cached via ApiResolutionCache (LRU cache) to avoid repeated expensive lookups during documentation generation. Cache is ephemeral (per-run) and does not persist across builds.

## Signature

```typescript theme={null}
export declare class CustomMarkdownEmitter extends MarkdownEmitter 
```

## Constructors

### constructor

Constructs a new instance of the class

## Properties

*No properties defined.*

## Methods

### emit

Emits markdown content from a DocNode tree.Entry point for the emission process. Delegates to parent class implementation which handles the recursive node traversal via .

### writeLinkTagWithCodeDestination

**Modifiers**: protected

Writes a link tag that references code entities (API items).Overrides parent implementation to: 1. Resolve API references via ApiModel with caching 2. Generate markdown links to resolved items' documentation pages 3. Use scoped names as link text when not explicitly provided

### writeNode

**Modifiers**: protected

Writes a single DocNode to the output.Overrides parent implementation to add custom handling for: - DocHeading - Markdown headings with configurable levels - DocNoteBox - Block quotes for note/warning boxes - DocTable - Mintlify components (TypeTree, ResponseField) or HTML fallback - DocEmphasisSpan - Bold/italic text spans - DocExpandable - Collapsible sectionsAll other node types delegate to parent class.

## Events

*No events defined.*

## Related Documentation

* <PageLink target="/architecture/emission-layer">Emission layer architecture</PageLink>
* <PageLink target="/components/type-tree">TypeTree component documentation</PageLink>
