Socket
Socket
Sign inDemoInstall

@types/mdast

Package Overview
Dependencies
1
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/mdast

TypeScript definitions for mdast


Version published
Weekly downloads
9.7M
decreased by-0.95%
Maintainers
1
Install size
34.9 kB
Created
Weekly downloads
 

Package description

What is @types/mdast?

The @types/mdast package provides TypeScript definitions for MDAST, a syntax tree format for Markdown documents. This allows developers to work with Markdown documents in a structured way, leveraging TypeScript's type checking for better code reliability and developer experience. It's primarily used in projects where Markdown processing is involved, and TypeScript is the preferred language.

What are @types/mdast's main functionalities?

Node Type Definitions

Defines the structure of various Markdown AST nodes, such as documents (Root), paragraphs (Paragraph), and text (Text). This is useful for creating or manipulating Markdown documents programmatically.

{"import { Root, Paragraph, Text } from 'mdast';
const root: Root = {
  type: 'root',
  children: [{
    type: 'paragraph',
    children: [{
      type: 'text',
      value: 'Hello, world!'
    }]
  }]
};"}

Type Guards

Provides type guards to assert node types at runtime, facilitating the implementation of type-safe operations on Markdown AST nodes.

{"import { isRoot, isParagraph } from 'mdast';
function processNode(node: Node) {
  if (isRoot(node)) {
    console.log('Processing root node');
  } else if (isParagraph(node)) {
    console.log('Processing paragraph node');
  }
}"}

Other packages similar to @types/mdast

Readme

Source

Installation

npm install --save @types/mdast

Summary

This package contains type definitions for mdast (https://github.com/syntax-tree/mdast).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast.

Additional Details

  • Last updated: Tue, 07 Nov 2023 20:08:00 GMT
  • Dependencies: @types/unist

Credits

These definitions were written by Christian Murphy, Jun Lu, Remco Haszing, Titus Wormer, and Remco Haszing.

FAQs

Last updated on 07 Nov 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc