npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@docen/extensions

v0.0.9

Published

Collection of TipTap extensions with TypeScript type definitions for Docen

Downloads

185

Readme

@docen/extensions

npm version npm downloads npm license

Curated collection of TipTap extensions with comprehensive TypeScript type definitions for Docen.

Features

  • 📦 All-in-One Package - All Docen-required extensions in a single dependency
  • 🔒 Full Type Safety - Comprehensive TypeScript definitions for all content nodes and marks
  • 🎯 Curated Selection - Only includes extensions actively used in Docen, no bloat
  • 📤 Type Exports - Direct access to all node types (DocumentNode, ParagraphNode, etc.)
  • 🚀 Ready to Use - Pre-configured extension arrays for blocks and marks

Installation

# Install with npm
$ npm install @docen/extensions

# Install with yarn
$ yarn add @docen/extensions

# Install with pnpm
$ pnpm add @docen/extensions

Quick Start

import { tiptapExtensions, tiptapMarkExtensions } from "@docen/extensions";

const editor = new Editor({
  extensions: [
    ...tiptapExtensions, // All block extensions
    ...tiptapMarkExtensions, // All mark extensions
  ],
  content: "<p>Hello, world!</p>",
});

Exports

Extension Arrays

tiptapExtensions - Block-level extensions:

  • Document - Root document node
  • Paragraph - Standard paragraphs
  • Heading - H1-H6 headings
  • Blockquote - Blockquote sections
  • CodeBlock - Code blocks with Lowlight syntax highlighting
  • HorizontalRule - Horizontal dividers
  • Image - Image embedding
  • Details - Collapsible details/summary sections
  • Table - Table containers
  • TableRow - Table rows
  • TableCell - Table body cells
  • TableHeader - Table header cells
  • BulletList - Unordered lists
  • OrderedList - Ordered lists with start support
  • ListItem - List item containers
  • TaskList - Task list containers
  • TaskItem - Task items with checkboxes

tiptapMarkExtensions - Text formatting marks:

  • Bold - Bold text
  • Italic - Italic text
  • Underline - Underlined text
  • Strike - ~~Strikethrough text~~
  • Code - Inline code
  • Highlight - Text highlighting
  • Subscript - Sub~script~
  • Superscript - Super^script^
  • TextStyle - Text styling (colors, fonts, sizes)
  • Link - Hyperlinks with href, target, rel attributes

TypeScript Types

This package exports comprehensive TypeScript types for type-safe development:

import type {
  // Root and document types
  JSONContent,

  // Block nodes
  DocumentNode,
  ParagraphNode,
  HeadingNode,
  BlockquoteNode,
  CodeBlockNode,
  HorizontalRuleNode,
  ImageNode,
  DetailsNode,

  // List nodes
  BulletListNode,
  OrderedListNode,
  ListItemNode,
  TaskListNode,
  TaskItemNode,

  // Table nodes
  TableNode,
  TableRowNode,
  TableCellNode,
  TableHeaderNode,

  // Text nodes
  TextNode,
  HardBreakNode,

  // Type unions
  BlockNode,
  TextContent,
} from "@docen/extensions";

Type Definitions

Content Nodes:

// Paragraph with text alignment and spacing
interface ParagraphNode {
  type: "paragraph";
  attrs?: {
    textAlign?: "left" | "right" | "center" | "justify";
    indentLeft?: number;
    indentRight?: number;
    indentFirstLine?: number;
    spacingBefore?: number;
    spacingAfter?: number;
  };
  content?: Array<TextContent>;
}

// Heading with level and spacing
interface HeadingNode {
  type: "heading";
  attrs: {
    level: 1 | 2 | 3 | 4 | 5 | 6;
    indentLeft?: number;
    indentRight?: number;
    indentFirstLine?: number;
    spacingBefore?: number;
    spacingAfter?: number;
  };
  content?: Array<TextContent>;
}

// Table with colspan/rowspan
interface TableCellNode {
  type: "tableCell" | "tableHeader";
  attrs?: {
    colspan?: number;
    rowspan?: number;
    colwidth?: number[] | null;
  };
  content?: Array<ParagraphNode>;
}

// Image with attributes (extended from TipTap)
interface ImageNode {
  type: "image";
  attrs?: {
    src: string;
    alt?: string | null;
    title?: string | null;
    width?: number | null;
    height?: number | null;
    rotation?: number; // Rotation in degrees (not in TipTap core)
    floating?: ImageFloatingOptions; // Floating positioning options (not in TipTap core)
    outline?: ImageOutlineOptions; // Border/outline options (not in TipTap core)
  };
}

Text and Marks:

// Text node with marks
interface TextNode {
  type: "text";
  text: string;
  marks?: Array<Mark>;
}

// Mark with attributes
interface Mark {
  type:
    | "bold"
    | "italic"
    | "underline"
    | "strike"
    | "code"
    | "textStyle"
    | "link"
    | "highlight"
    | "subscript"
    | "superscript";
  attrs?: {
    // TextStyle attributes
    color?: string;
    backgroundColor?: string;
    fontSize?: string;
    fontFamily?: string;
    lineHeight?: string;

    // Link attributes
    href?: string;
    target?: string;
    rel?: string;
    class?: string | null;

    // Other attributes
    [key: string]: unknown;
  };
}

Usage Examples

Type-Safe Content Creation

import type { JSONContent, ParagraphNode } from "@docen/extensions";

const doc: JSONContent = {
  type: "doc",
  content: [
    {
      type: "paragraph",
      content: [
        {
          type: "text",
          marks: [{ type: "bold" }],
          text: "Hello, world!",
        },
      ],
    },
  ],
};

// Type narrowing with type guards
function isParagraph(node: JSONContent): node is ParagraphNode {
  return node.type === "paragraph";
}

Working with Tables

import type { TableNode, TableCellNode } from "@docen/extensions";

const table: TableNode = {
  type: "table",
  content: [
    {
      type: "tableRow",
      content: [
        {
          type: "tableHeader",
          attrs: { colspan: 2, rowspan: 1 },
          content: [
            {
              type: "paragraph",
              content: [{ type: "text", text: "Header" }],
            },
          ],
        },
      ],
    },
  ],
};

Custom Editor Setup

import { Editor } from "@tiptap/core";
import { tiptapExtensions } from "@docen/extensions";

const editor = new Editor({
  extensions: [
    ...tiptapExtensions,
    // Add your custom extensions here
  ],
});

Import Paths

This package provides two import paths for flexibility:

// Main entry point - extensions and types
import { tiptapExtensions, tiptapMarkExtensions } from "@docen/extensions";
import type { JSONContent, ParagraphNode } from "@docen/extensions";

// Types-only path for type definitions
import type { JSONContent } from "@docen/extensions/types";

Contributing

Contributions are welcome! Please read our Contributor Covenant and submit pull requests to the main repository.

License