Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/tsdoc

Package Overview
Dependencies
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/tsdoc

A parser for the TypeScript doc comment syntax

  • 0.8.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4M
decreased by-53.37%
Maintainers
2
Weekly downloads
 
Created

What is @microsoft/tsdoc?

@microsoft/tsdoc is a library for parsing and analyzing TypeScript doc comments. It provides a standardized way to document TypeScript code, enabling developers to create consistent and comprehensive documentation for their projects.

What are @microsoft/tsdoc's main functionalities?

Parsing TSDoc Comments

This feature allows you to parse TSDoc comments from a string. The parser processes the comment and provides a structured representation of its content, which can be used for further analysis or documentation generation.

const tsdoc = require('@microsoft/tsdoc');

const parser = new tsdoc.TSDocParser();
const text = `/**
 * This is a summary.
 *
 * @remarks
 * Additional details go here.
 *
 * @param paramName - Description of the parameter.
 * @returns Description of the return value.
 */`;
const parserContext = parser.parseString(text);

console.log(parserContext.docComment.summarySection.toString());

Custom TSDoc Tags

This feature allows you to define and use custom TSDoc tags. By extending the TSDoc configuration, you can introduce new tags that suit your project's specific documentation needs.

const tsdoc = require('@microsoft/tsdoc');

const configuration = new tsdoc.TSDocConfiguration();
configuration.addTagDefinition(new tsdoc.TSDocTagDefinition({
  tagName: '@customTag',
  syntaxKind: tsdoc.TSDocTagSyntaxKind.BlockTag
}));

const parser = new tsdoc.TSDocParser(configuration);
const text = `/**
 * This is a summary.
 *
 * @customTag
 * Custom tag content.
 */`;
const parserContext = parser.parseString(text);

console.log(parserContext.docComment.customBlocks[0].blockTag.tagName);

Validation of TSDoc Comments

This feature allows you to validate TSDoc comments and identify any issues or inconsistencies. The parser logs messages that can be reviewed to ensure the documentation adheres to the expected standards.

const tsdoc = require('@microsoft/tsdoc');

const parser = new tsdoc.TSDocParser();
const text = `/**
 * This is a summary.
 *
 * @param paramName - Description of the parameter.
 * @returns Description of the return value.
 */`;
const parserContext = parser.parseString(text);

const messages = parserContext.log.messages;
messages.forEach(message => {
  console.log(`${message.messageId}: ${message.text}`);
});

Other packages similar to @microsoft/tsdoc

Keywords

FAQs

Package last updated on 07 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc