docblock-parser is a standalone, line-based library designed for parsing JSDoc-style comment blocks. Currently at version 1.0.0, it differentiates itself by offering a less opinionated approach compared to many other parsers, providing extensive customization through configurable regular expression patterns and tag-specific consumer functions. It avoids making fixed assumptions about the values associated with tags, empowering developers to precisely define how lines following a tag are interpreted. The v1.0.0 release notably introduced new configuration options for `docblockPattern`, `startPattern`, `endPattern`, and `linePattern`, significantly enhancing its flexibility for adapting to various docblock formats. While no explicit release cadence is provided, the library aims for stable, configurable parsing solutions.
npm install docblock-parserVerified import paths — ran on the pinned version, not inferred.
This example demonstrates parsing a multi-line docblock with custom tag consumers for standard JSDoc tags like `@public`, `@extends`, `@param`, and `@returns`, as well as a custom `multiline-example` tag.
Review the new `docblockPattern`, `startPattern`, `endPattern`, and `linePattern` configuration options in the README for custom parsing scenarios.
Always check `Array.isArray(result.text)` and `Array.isArray(result.tags[tagName])` if your logic depends on the cardinality of these fields. Design your consumers to consistently return a single type (e.g., always an array) if uniform handling is required.
Use `const docblockParser = require('docblock-parser');` for robust compatibility in Node.js. If using ESM, ensure your build setup correctly handles CommonJS module interop or consider using dynamic `import('docblock-parser')`.Ensure `const docblockParser = require('docblock-parser');` is used and the variable name matches. If you're trying to call the `parse` method directly, it's `docblockParser.parse(docstring)` or `docblockParser(config).parse(docstring)`.Verify that `docblock-parser` is correctly installed via `npm install docblock-parser` and that the `require('docblock-parser')` path is correct relative to your file.No dependency data recorded yet.