Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@microsoft/tsdoc
Advanced tools
@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.
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}`);
});
TypeDoc is a documentation generator for TypeScript projects. It generates HTML documentation from TypeScript source files, leveraging TypeScript's type system to provide detailed and accurate documentation. Unlike @microsoft/tsdoc, which focuses on parsing and analyzing doc comments, TypeDoc is more about generating complete documentation websites.
JSDoc is a popular documentation generator for JavaScript and TypeScript. It uses special comments to generate HTML documentation. While JSDoc is more mature and widely used, it does not provide the same level of TypeScript-specific features and integration as @microsoft/tsdoc.
Documentation.js is a documentation generator for JavaScript and TypeScript. It supports various output formats, including HTML and Markdown. Similar to JSDoc, it focuses on generating documentation from comments but lacks the TypeScript-specific features provided by @microsoft/tsdoc.
This library is the reference implementation of a parser for the TSDoc syntax. Using this library is an easy way to ensure that your tool is 100% compatible with the standard.
TSDoc is a proposal to standardize the doc comments used in TypeScript source files. It allows different tools to extract content from comments without getting confused by each other's syntax. The TSDoc notation looks pretty familiar:
/**
* Adds two numbers together.
*
* @remarks
* This method is part of the {@link core-library/Math | Math subsystem}.
*
* @param x - The first number to add
* @param y - The second number to add
* @returns The sum of `x` and `y`
*
* @beta
*/
function add(x: number, y: number): number;
The TSDoc project is under active development and evolving. For up to date documentation and other background, please visit the project site:
FAQs
A parser for the TypeScript doc comment syntax
The npm package @microsoft/tsdoc receives a total of 1,268,573 weekly downloads. As such, @microsoft/tsdoc popularity was classified as popular.
We found that @microsoft/tsdoc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.