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

@contentful/rich-text-types

Package Overview
Dependencies
Maintainers
0
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentful/rich-text-types

Type definitions and constants for the Contentful rich text field type.

  • 17.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3M
increased by38.87%
Maintainers
0
Weekly downloads
 
Created

What is @contentful/rich-text-types?

@contentful/rich-text-types is a TypeScript library that provides type definitions for the Contentful Rich Text field type. It allows developers to work with Contentful's rich text data in a type-safe manner, ensuring that the data structures are correctly handled and manipulated.

What are @contentful/rich-text-types's main functionalities?

Type Definitions for Rich Text Nodes

This feature provides type definitions for different types of rich text nodes, such as blocks, inlines, and marks. The code sample demonstrates how to define a paragraph block with bold text.

import { BLOCKS, INLINES, MARKS } from '@contentful/rich-text-types';

const node = {
  nodeType: BLOCKS.PARAGRAPH,
  content: [
    {
      nodeType: 'text',
      value: 'Hello, world!',
      marks: [{ type: MARKS.BOLD }],
      data: {}
    }
  ],
  data: {}
};

Type Definitions for Rich Text Document

This feature provides type definitions for the entire rich text document structure. The code sample shows how to define a simple document with a single paragraph.

import { Document } from '@contentful/rich-text-types';

const document: Document = {
  nodeType: 'document',
  data: {},
  content: [
    {
      nodeType: 'paragraph',
      content: [
        {
          nodeType: 'text',
          value: 'This is a paragraph.',
          marks: [],
          data: {}
        }
      ],
      data: {}
    }
  ]
};

Type Definitions for Rich Text Marks

This feature provides type definitions for text marks such as bold and italic. The code sample demonstrates how to use these type definitions.

import { MARKS } from '@contentful/rich-text-types';

const boldMark = MARKS.BOLD;
const italicMark = MARKS.ITALIC;

Other packages similar to @contentful/rich-text-types

FAQs

Package last updated on 29 Oct 2024

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