tsdoc_mdz.ts

Bridge between TSDoc format and mdz for rendering.

This module converts raw TSDoc syntax (from the analysis library) to mdz format (Fuz's documentation rendering dialect). It lives here in @fuzdev/mdz, not the svelte-docinfo analysis library, to keep that library format-agnostic.

view source

Declarations
#

mdz_from_tsdoc
#

tsdoc_mdz.ts view source

(content: string): string import {mdz_from_tsdoc} from '@fuzdev/mdz/tsdoc_mdz.js';

Convert raw TSDoc @see content to mdz format for rendering.

Handles TSDoc link syntax:

  • |text[text](url) (markdown link, TSDoc canonical form)
  • text[text](url) (TS-lenient space-separated form)
  • ://...https://... (bare URL, auto-linked by mdz)
  • `` → `` identifier `` (code formatting)
  • Bare URLs → returned as-is
  • Bare markdown links ([text](url) ...) → returned as-is
  • Bare identifiers → wrapped in backticks
  • identifier description text → `` identifier description text `` (first token is the reference)

content

raw @see tag content in TSDoc format

type string

returns

string

mdz-formatted string ready for Mdz component

examples

mdz_from_tsdoc('://fuz.dev|API Docs') // → '[API Docs](https://fuz.dev)' mdz_from_tsdoc('') // → '`SomeType`' mdz_from_tsdoc('https://fuz.dev') // → 'https://fuz.dev' mdz_from_tsdoc('[svelte-docinfo](https://github.com/ryanatkn/svelte-docinfo) for the analysis library') // → '[svelte-docinfo](https://github.com/ryanatkn/svelte-docinfo) for the analysis library' mdz_from_tsdoc('tome.ts for the documentation system') // → '`tome.ts` for the documentation system'

Depends on
#