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

@tiptap/extension-paragraph

Package Overview
Dependencies
Maintainers
4
Versions
166
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/extension-paragraph

paragraph extension for tiptap

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
increased by5.66%
Maintainers
4
Weekly downloads
 
Created

What is @tiptap/extension-paragraph?

@tiptap/extension-paragraph is an extension for the Tiptap editor that provides support for paragraph nodes. It allows you to define and manipulate paragraphs within the Tiptap rich-text editor, enabling you to create, format, and manage text content in a structured way.

What are @tiptap/extension-paragraph's main functionalities?

Basic Paragraph Node

This code demonstrates how to include the Paragraph extension in a Tiptap editor instance. It allows the editor to recognize and handle paragraph nodes.

import { Paragraph } from '@tiptap/extension-paragraph';

const editor = new Editor({
  extensions: [
    Paragraph,
  ],
});

Custom Paragraph Attributes

This code shows how to extend the Paragraph extension to add custom attributes. In this example, a custom attribute named 'customAttribute' is added to the paragraph node.

import { Paragraph } from '@tiptap/extension-paragraph';

const CustomParagraph = Paragraph.extend({
  addAttributes() {
    return {
      customAttribute: {
        default: null,
      },
    };
  },
});

const editor = new Editor({
  extensions: [
    CustomParagraph,
  ],
});

Custom Paragraph Styling

This code demonstrates how to extend the Paragraph extension to apply custom styling. The 'renderHTML' method is overridden to add a custom CSS class to the paragraph element.

import { Paragraph } from '@tiptap/extension-paragraph';

const CustomParagraph = Paragraph.extend({
  renderHTML({ HTMLAttributes }) {
    return ['p', { ...HTMLAttributes, class: 'custom-paragraph' }, 0];
  },
});

const editor = new Editor({
  extensions: [
    CustomParagraph,
  ],
});

Other packages similar to @tiptap/extension-paragraph

Keywords

FAQs

Package last updated on 30 Mar 2023

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