User Rating 0.0
Total Usage 0 times
Output will appear here after conversion...
Is this tool helpful?

Your feedback helps us improve.

About

Maintaining API documentation by hand introduces drift between code and docs. JSDoc comment blocks follow a strict grammar defined by the JSDoc 3 specification: a description line, followed by block tags like @param, @returns, and @constructor. This tool parses those blocks, associates each with its immediately following declaration (function, class, or variable), and emits structured Markdown with parameter tables, return types, and access badges. It handles nested parameter notation such as options.prop by indenting sub-parameters under their parent row. Filtering modes replicate the CLI flags --only-public (emit only blocks bearing an explicit @public tag) and --exclude-private (suppress blocks marked @private). Note: the parser assumes well-formed JSDoc 3 syntax. Malformed blocks (missing closing */, orphan tags outside comment blocks) are silently skipped rather than producing corrupt output.

jsdoc markdown documentation converter github api-docs jsdoc3

Formulas

The converter operates as a three-stage pipeline: ExtractParseRender.

Extract(source) [Block0, Block1, …, Blockn]

Each Block is a tuple of the raw comment text and the declaration line immediately following it. Extraction uses the regular expression pattern:

pattern = /\/\*\*([\s\S]*?)\*\//g

The parser then splits each block into lines, strips leading asterisks, and classifies each line as either a tag line or a continuation of the previous description. Tag lines match:

tagPattern = /^@(\w+)\s*(?:\{([^}]*)\})?\s*(\S+)?\s*(.*)?/

Filtering logic applies a predicate F over the parsed tag set T of each block:

{
keep(block) = TRUE if @public T (only-public mode)keep(block) = FALSE if @private T (exclude-private mode)keep(block) = TRUE otherwise

Where T is the set of all tag names extracted from a given comment block, and @public and @private are string literals matched by exact equality. The renderer maps each parsed structure to its Markdown equivalent: function names become ## headings, parameters become pipe-delimited table rows with columns for Name, Type, and Description, and nested params (containing a dot separator) are indented with a non-breaking space prefix in the Name column.

Reference Data

TagSyntaxMarkdown OutputNotes
@param@param {type} name descRow in Parameters tableSupports name.sub nesting
@returns@returns {type} descReturns: lineAlias @return also accepted
@constructor@constructorBadge: ConstructorNo value expected
@public@publicBadge: PublicUsed by only-public filter
@private@privateBadge: PrivateUsed by exclude-private filter
@type@type {type}Type: lineFor variable declarations
@typedef@typedef {type} NameHeading with type noteCustom type definition
@callback@callback NameHeading as callbackFollowed by @param tags
@throws@throws {type} descThrows: lineAlias @exception
@example@example + code linesFenced code blockAll lines until next tag or end
@deprecated@deprecated reasonDeprecation warningRenders as blockquote
@see@see referenceSee: link/textMultiple allowed
@since@since versionSince: versionSemantic version string
@version@version versionVersion: stringApplied to module/class
@author@author nameAuthor: nameMultiple allowed
@license@license identifierLicense: stringSPDX identifier preferred
@module@module nameModule headingTop-level grouping
@namespace@namespace nameNamespace headingObject literal grouping
@memberof@memberof parentScoped under parentPrefix with parent name
@static@staticBadge: StaticClass-level method
@abstract@abstractBadge: AbstractMust be overridden
@async@asyncBadge: AsyncReturns Promise
@fires@fires EventNameFires: eventEvent emission
@listens@listens EventNameListens: eventEvent subscription
@emits@emits EventNameEmits: eventAlias for @fires
@default@default valueDefault: valueProperty default
@readonly@readonlyBadge: Read OnlyImmutable property
@override@overrideBadge: OverrideOverrides parent method
@enum@enum {type}Enum heading with typeEnumeration definition

Frequently Asked Questions

When a @param tag name contains a dot (e.g., options.prop), the converter treats it as a child parameter. In the generated Markdown table, the parent name (options) appears as a normal row, and options.prop is rendered with an indented name ( prop) to visually indicate hierarchy. This mirrors how JSDoc 3 documents object property destructuring.
The parser requires a non-empty code line immediately following the closing */ of a comment block. If the next line is blank or another comment, the block is labeled as an orphan and its heading defaults to Undocumented Block. The content (description, tags) is still rendered. This commonly occurs with file-level @module or @file comments that precede imports rather than declarations.
Yes. When both filters are active, --only-public takes strict precedence: only blocks containing an explicit @public tag are emitted. The --exclude-private filter then becomes redundant in practice, since any block lacking @public is already excluded regardless of whether it carries @private. If only --exclude-private is active, all blocks except those explicitly marked @private are included.
Yes. Content following an @example tag is collected until the next tag or the end of the comment block. The converter wraps this content in a fenced code block using triple backticks with a js language hint (` ```js `). If the example content itself contains backticks, they are preserved as-is since Markdown fenced blocks delimit by the outermost fence.
@param tags accumulate into a Markdown table with Name, Type, and Description columns. @returns (or its alias @return) renders as a single bold line: Returns {type} - description. @throws (alias @exception) renders similarly but prefixed with Throws. Multiple @throws tags produce multiple lines, reflecting that a function may throw different exception types under different conditions.
The parser extracts the name from the first non-empty line following */ using patterns for: function Name, class Name, const/let/var Name, Name: function (object method shorthand), Name( (ES6 method shorthand), and module.exports. Arrow functions assigned to variables (e.g., const fn = () => {}) are captured via the variable name. If no pattern matches, the raw line is used as the heading text.