BlockNote Documentation

repository·main·Indexed 27 days ago

https://github.com/typecellos/blocknote

An open-source, block-based rich text editor for React applications built on ProseMirror and Tiptap. It features slash menus, drag-and-drop blocks, real-time collaboration via Yjs, and a comprehensive API for block manipulation, parsing, and exporting. The ecosystem includes @blocknote/core for fundamental interfaces, @blocknote/react for client integration, and XL packages for AI server proxying and DOCX/ODT export.

Tokens
65.9K
Snippets
167
Records
385
Agent score
87%

What's inside BlockNote

  1. Introduction to BlockNote

    main

    BlockNote is a block-based rich-text editor designed for React. It provides a high-quality user experience (UX) similar to Notion, Google Docs, or Coda with minimal setup.

    Key characteristics:

    • Block-based structure: Documents are organized into blocks, making them easier for users to navigate and for developers to manipulate via code.
    • Extensibility: Developers can create custom block types, customize UX elements (like menu items), or even build their own UI from scratch using vanilla JavaScript.
    • Built on industry standards: It is built on top of ProseMirror and TipTap, providing a powerful foundation with a much lower learning curve.
  2. Overview of the @blocknote/core API surface

    main

    The @blocknote/core API provides the fundamental interfaces for interacting with BlockNote documents. It is divided into four primary functional areas:

    • Block Manipulation: APIs for inserting, updating, or removing blocks within a document.
    • Exporters: Tools for exporting document content into various formats such as HTML, Markdown, and others.
    • Parsers: Tools for importing content from external formats like HTML or Markdown into the BlockNote schema.
    • Node Conversions: The internal mechanism used to translate between the BlockNote Schema (Blocks) and the underlying ProseMirror Nodes.
  3. Compare BlockNote Support Plans

    main

    BlockNote offers two tiers of technical support included with or added to the BlockNote Commercial License:

    Standard Support

    • Prioritization: Issues from the Licensee's team are prioritized over community users.
    • Channels: Direct access via GitHub and email.

    Priority Support

    • Response Time: Guaranteed 48-hour first-response time.
    • Prioritization: Issues are prioritized over the 'Standard Support' plan.
    • Channels: Direct access via GitHub, email, and a dedicated Slack channel.
  4. BlockNote Core Features

    main

    BlockNote provides a modern block-based editing experience with the following built-in features:

    • Slash (/) menu: Quickly insert blocks and commands.
    • Drag and drop: Reorder blocks easily.
    • Nesting/Indentation: Use Tab and Shift+Tab to manage block hierarchy.
    • Format menu: Contextual formatting options.
    • Real-time collaboration: Support for multi-user editing.
    • Helpful placeholders: Visual cues for empty blocks.
    • Animations: Smooth UI transitions.
  5. Understand BlockNote XL Dual Licensing

    main

    BlockNote XL Packages (such as Exporters for PDF/Docx/ODT, Multi-Column, and Generative AI functionality) are available under a dual-license model. You must choose between:

    1. GPL (Open Source): Any modifications or derivative works must also be made available under the terms of the GNU General Public License version 3.0.
    2. Commercial License: Use the software under the specific terms of the BlockNote Commercial License Agreement, which allows for proprietary use without GPL reciprocity requirements.
  6. Understand BlockNote XL Commercial License terms

    main

    The BlockNote XL Commercial License governs the use of BlockNote XL software. Key legal provisions include:

    • Indemnification: The Licensor defends against intellectual property claims provided prompt notice is given. The Licensee indemnifies the Licensor against claims arising from material breaches of the agreement.
    • Confidentiality: Both parties must maintain the confidentiality of information received under the agreement, with standard exceptions for public knowledge or independent development.
    • Data Privacy: Personal data is handled according to the Licensor's privacy policy and stored with reasonable security safeguards.
    • Amendments: The Licensor may unilaterally amend the agreement. Continued use after an amendment constitutes acceptance. Pricing changes only apply to future updates; users retain access to the version purchased under existing pricing.
    • Governing Law: The agreement is subject to Dutch law, with exclusive jurisdiction in the Courts of the Netherlands (Court of Rotterdam).
  7. Choose a migration strategy between editors

    main

    When switching from a legacy editor to BlockNote, consider one of these three strategies:

    1. Legacy Editor Approach: Run both editors in parallel. Use the old editor for existing content and BlockNote for new content. This minimizes disruption.
    2. Hard Cutoff: Migrate all content at once on a specific date. This provides a clean break but requires more upfront preparation.
    3. Gradual Migration: Convert content progressively (e.g., when a user opens a file). This offers a smoother transition but extends the migration period.
  8. Integrate AI functionality with BlockNote AI

    main

    You can add AI capabilities to your BlockNote rich text editor using the @blocknote/xl-ai package. This allows users to work with an AI agent to edit, write, and format documents.

    Key features include:

    • Interactive AI Suggestions: Users can accept or reject suggestions.
    • Real-time Feedback: Support for streaming responses.
    • Transparent Operations: Visual indicators of AI actions.
    • Model Agnostic: Connect to any LLM (OpenAI, Anthropic, Mistral, Llama, etc.).
    • Customizable Prompts: Fine-tune behavior with custom instructions.
    • RAG Support: Extend AI knowledge with your own Retrieval-Augmented Generation pipeline.

    Note on Licensing: The @blocknote/xl-ai package is open source but released under a copyleft license. For usage in closed-source, proprietary products, a commercial license is required via a Business subscription.

  9. Understand StreamTools concept

    main

    StreamTools is a concept implemented to handle tool calls in a streaming manner. It is similar to a Tool in the Vercel AI SDK but offers two key advantages:

    1. Batching: A collection of StreamTools can be wrapped into a single LLM Tool, allowing multiple operations (tool calls) to be issued simultaneously.
    2. Streaming Support: StreamTools can be used in a streaming manner, meaning non-complete tool calls can be evaluated as they are being generated.