# Change Log

## 3.23.4

### Patch Changes

- @tiptap/core@3.23.4
- @tiptap/pm@3.23.4

## 3.23.3

### Patch Changes

- @tiptap/core@3.23.3
- @tiptap/pm@3.23.3

## 3.23.2

### Patch Changes

- Updated dependencies [f98eaaf]
  - @tiptap/core@3.23.2
  - @tiptap/pm@3.23.2

## 3.23.1

### Patch Changes

- @tiptap/core@3.23.1
- @tiptap/pm@3.23.1

## 3.23.0

### Patch Changes

- Updated dependencies [57f8d66]
- Updated dependencies [e64e5a7]
- Updated dependencies [207a2bc]
  - @tiptap/core@3.23.0
  - @tiptap/pm@3.23.0

## 3.22.5

### Patch Changes

- 13b5894: Escape HTML string renderer text content and attribute values to prevent injected markup from untrusted content.
- Updated dependencies [a375002]
  - @tiptap/core@3.22.5
  - @tiptap/pm@3.22.5

## 3.22.4

### Patch Changes

- 27ea931: Fix dependencies installation after packages updates producing peer dependency resolution conflicts
- Updated dependencies [27ea931]
- Updated dependencies [64f36b8]
- Updated dependencies [032f8f1]
  - @tiptap/core@3.22.4
  - @tiptap/pm@3.22.4

## 3.22.3

### Patch Changes

- Updated dependencies [cb28e7b]
  - @tiptap/core@3.22.3
  - @tiptap/pm@3.22.3

## 3.22.2

### Patch Changes

- Updated dependencies [f1d504c]
- Updated dependencies [404c683]
  - @tiptap/core@3.22.2
  - @tiptap/pm@3.22.2

## 3.22.1

### Patch Changes

- Updated dependencies [ee03ac0]
- Updated dependencies [b88f9ed]
  - @tiptap/core@3.22.1
  - @tiptap/pm@3.22.1

## 3.22.0

### Patch Changes

- Updated dependencies [912a49b]
- Updated dependencies [7d4fb9a]
- Updated dependencies [0c1c112]
- Updated dependencies [0c1c112]
- Updated dependencies [f99bdc2]
  - @tiptap/core@3.22.0
  - @tiptap/pm@3.22.0

## 3.21.0

### Patch Changes

- @tiptap/core@3.21.0
- @tiptap/pm@3.21.0

## 3.20.6

### Patch Changes

- @tiptap/core@3.20.6
- @tiptap/pm@3.20.6

## 3.20.5

### Patch Changes

- @tiptap/core@3.20.5
- @tiptap/pm@3.20.5

## 3.20.4

### Patch Changes

- Updated dependencies [0bcf3c2]
  - @tiptap/core@3.20.4
  - @tiptap/pm@3.20.4

## 3.20.3

### Patch Changes

- Updated dependencies [c94fac4]
- Updated dependencies [6b9ea92]
  - @tiptap/core@3.20.3
  - @tiptap/pm@3.20.3

## 3.20.2

### Patch Changes

- Updated dependencies [269823d]
  - @tiptap/core@3.20.2
  - @tiptap/pm@3.20.2

## 3.20.1

### Patch Changes

- Updated dependencies [25f57e4]
  - @tiptap/core@3.20.1
  - @tiptap/pm@3.20.1

## 3.20.0

### Patch Changes

- Updated dependencies [4b731e2]
- Updated dependencies [98546ac]
- Updated dependencies [57624a1]
- Updated dependencies [76ce47d]
  - @tiptap/core@3.20.0
  - @tiptap/pm@3.20.0

## 3.19.0

### Patch Changes

- @tiptap/core@3.19.0
- @tiptap/pm@3.19.0

## 3.18.0

### Patch Changes

- @tiptap/core@3.18.0
- @tiptap/pm@3.18.0

## 3.17.1

### Patch Changes

- Updated dependencies [aa9709e]
- Updated dependencies [b46e66a]
  - @tiptap/core@3.17.1
  - @tiptap/pm@3.17.1

## 3.17.0

### Patch Changes

- Updated dependencies [eecf1c9]
  - @tiptap/core@3.17.0
  - @tiptap/pm@3.17.0

## 3.16.0

### Patch Changes

- @tiptap/core@3.16.0
- @tiptap/pm@3.16.0

## 3.15.3

### Patch Changes

- Updated dependencies [8f86f06]
  - @tiptap/core@3.15.3
  - @tiptap/pm@3.15.3

## 3.15.2

### Patch Changes

- @tiptap/core@3.15.2
- @tiptap/pm@3.15.2

## 3.15.1

### Patch Changes

- @tiptap/core@3.15.1
- @tiptap/pm@3.15.1

## 3.15.0

### Patch Changes

- Updated dependencies [ac8361c]
  - @tiptap/core@3.15.0
  - @tiptap/pm@3.15.0

## 3.14.0

### Patch Changes

- @tiptap/core@3.14.0
- @tiptap/pm@3.14.0

## 3.13.0

### Patch Changes

- Updated dependencies [526365a]
- Updated dependencies [e3b4f68]
  - @tiptap/core@3.13.0
  - @tiptap/pm@3.13.0

## 3.12.1

### Patch Changes

- @tiptap/core@3.12.1
- @tiptap/pm@3.12.1

## 3.12.0

### Patch Changes

- Updated dependencies [f232c5a]
  - @tiptap/core@3.12.0
  - @tiptap/pm@3.12.0

## 3.11.1

### Patch Changes

- Updated dependencies [d0c4264]
  - @tiptap/core@3.11.1
  - @tiptap/pm@3.11.1

## 3.11.0

### Patch Changes

- Updated dependencies [541c93c]
  - @tiptap/core@3.11.0
  - @tiptap/pm@3.11.0

## 3.10.8

### Patch Changes

- 32eb2e8: Fix static HTML renderer incorrectly generating self-closing tags for HTML elements that require proper closing tags (iframe, script, style, etc.).
- Updated dependencies [8375241]
- Updated dependencies [b7ead7c]
- Updated dependencies [95d3e80]
- Updated dependencies [fd479bd]
  - @tiptap/core@3.10.8
  - @tiptap/pm@3.10.8

## 3.10.7

### Patch Changes

- @tiptap/core@3.10.7
- @tiptap/pm@3.10.7

## 3.10.6

### Patch Changes

- @tiptap/core@3.10.6
- @tiptap/pm@3.10.6

## 3.10.5

### Patch Changes

- Updated dependencies [92fae18]
  - @tiptap/core@3.10.5
  - @tiptap/pm@3.10.5

## 3.10.4

### Patch Changes

- Updated dependencies [64561c4]
  - @tiptap/core@3.10.4
  - @tiptap/pm@3.10.4

## 3.10.3

### Patch Changes

- @tiptap/core@3.10.3
- @tiptap/pm@3.10.3

## 3.10.2

### Patch Changes

- @tiptap/core@3.10.2
- @tiptap/pm@3.10.2

## 3.10.1

### Patch Changes

- Updated dependencies [3564e7c]
  - @tiptap/core@3.10.1
  - @tiptap/pm@3.10.1

## 3.10.0

### Patch Changes

- Updated dependencies [4aa9f57]
- Updated dependencies [4aa9f57]
  - @tiptap/core@3.10.0
  - @tiptap/pm@3.10.0

## 3.9.1

### Patch Changes

- @tiptap/core@3.9.1
- @tiptap/pm@3.9.1

## 3.9.0

### Patch Changes

- Updated dependencies [bbb8e16]
  - @tiptap/core@3.9.0
  - @tiptap/pm@3.9.0

## 3.8.0

### Patch Changes

- @tiptap/core@3.8.0
- @tiptap/pm@3.8.0

## 3.7.2

### Patch Changes

- @tiptap/core@3.7.2
- @tiptap/pm@3.7.2

## 3.7.1

### Patch Changes

- @tiptap/core@3.7.1
- @tiptap/pm@3.7.1

## 3.7.0

### Patch Changes

- Updated dependencies [35645d9]
- Updated dependencies [35645d9]
- Updated dependencies [35645d9]
  - @tiptap/core@3.7.0
  - @tiptap/pm@3.7.0

## 3.6.7

### Patch Changes

- @tiptap/core@3.6.7
- @tiptap/pm@3.6.7

## 3.6.6

### Patch Changes

- @tiptap/core@3.6.6
- @tiptap/pm@3.6.6

## 3.6.5

### Patch Changes

- Updated dependencies [1e4caea]
  - @tiptap/core@3.6.5
  - @tiptap/pm@3.6.5

## 3.6.4

### Patch Changes

- @tiptap/core@3.6.4
- @tiptap/pm@3.6.4

## 3.6.3

### Patch Changes

- Updated dependencies [67f7b4a]
  - @tiptap/core@3.6.3
  - @tiptap/pm@3.6.3

## 3.6.2

### Patch Changes

- @tiptap/core@3.6.2
- @tiptap/pm@3.6.2

## 3.6.1

### Patch Changes

- @tiptap/core@3.6.1
- @tiptap/pm@3.6.1

## 3.6.0

### Patch Changes

- Updated dependencies [c0190bd]
  - @tiptap/core@3.6.0
  - @tiptap/pm@3.6.0

## 3.5.3

### Patch Changes

- @tiptap/core@3.5.3
- @tiptap/pm@3.5.3

## 3.5.2

### Patch Changes

- @tiptap/core@3.5.2
- @tiptap/pm@3.5.2

## 3.5.1

### Patch Changes

- @tiptap/core@3.5.1
- @tiptap/pm@3.5.1

## 3.5.0

### Patch Changes

- @tiptap/core@3.5.0
- @tiptap/pm@3.5.0

## 3.4.6

### Patch Changes

- Updated dependencies [968016f]
  - @tiptap/core@3.4.6
  - @tiptap/pm@3.4.6

## 3.4.5

### Patch Changes

- Updated dependencies [0226d42]
- Updated dependencies [37af83b]
- Updated dependencies [f598ac7]
  - @tiptap/core@3.4.5
  - @tiptap/pm@3.4.5

## 3.4.4

### Patch Changes

- Updated dependencies [00cf1d7]
  - @tiptap/core@3.4.4
  - @tiptap/pm@3.4.4

## 3.4.3

### Patch Changes

- Updated dependencies [1ea8906]
  - @tiptap/core@3.4.3
  - @tiptap/pm@3.4.3

## 3.4.2

### Patch Changes

- @tiptap/core@3.4.2
- @tiptap/pm@3.4.2

## 3.4.1

### Patch Changes

- @tiptap/core@3.4.1
- @tiptap/pm@3.4.1

## 3.4.0

### Patch Changes

- Updated dependencies [895c73f]
- Updated dependencies [ad51daa]
  - @tiptap/core@3.4.0
  - @tiptap/pm@3.4.0

## 3.3.1

### Patch Changes

- @tiptap/core@3.3.1
- @tiptap/pm@3.3.1

## 3.3.0

### Patch Changes

- Updated dependencies [5423726]
- Updated dependencies [5423726]
  - @tiptap/core@3.3.0
  - @tiptap/pm@3.3.0

## 3.2.2

### Patch Changes

- @tiptap/core@3.2.2
- @tiptap/pm@3.2.2

## 3.2.1

### Patch Changes

- Updated dependencies [6a2873f]
  - @tiptap/core@3.2.1
  - @tiptap/pm@3.2.1

## 3.2.0

### Patch Changes

- Updated dependencies [5056e3e]
  - @tiptap/core@3.2.0
  - @tiptap/pm@3.2.0

## 3.1.0

### Patch Changes

- c0d33fd: Fixed a bug causing invalid number of columns being created while converting tables to Markdown
- 0943a52: Fixed an issue preventing overriding the default options of the static renderer's `renderToMarkdown` function.
  - @tiptap/core@3.1.0
  - @tiptap/pm@3.1.0

## 3.0.9

### Patch Changes

- 22d6050: fix renderToMarkdown rendering a link href's as undefined
  - @tiptap/core@3.0.9
  - @tiptap/pm@3.0.9

## 3.0.8

### Patch Changes

- @tiptap/core@3.0.8
- @tiptap/pm@3.0.8

## 3.0.7

### Patch Changes

- @tiptap/core@3.0.7
- @tiptap/pm@3.0.7

## 3.0.6

### Patch Changes

- Updated dependencies [2e71d05]
  - @tiptap/core@3.0.6
  - @tiptap/pm@3.0.6

## 3.0.5

### Patch Changes

- @tiptap/core@3.0.5
- @tiptap/pm@3.0.5

## 3.0.4

### Patch Changes

- Updated dependencies [7ed03fa]
  - @tiptap/core@3.0.4
  - @tiptap/pm@3.0.4

## 3.0.3

### Patch Changes

- Updated dependencies [75cabde]
  - @tiptap/core@3.0.3
  - @tiptap/pm@3.0.3

## 3.0.2

### Patch Changes

- @tiptap/core@3.0.2
- @tiptap/pm@3.0.2

## 3.0.1

### Major Changes

- 6a53bb2: # @tiptap/static-renderer

  The `@tiptap/static-renderer` package provides a way to render a Tiptap/ProseMirror document to any target format, like an HTML string, a React component, or even markdown. It does so, by taking the original JSON of a document (or document partial) and attempts to map this to the output format, by matching against a list of nodes & marks.

  ## Why Static Render?

  The main use case for static rendering is to render a Tiptap/ProseMirror document on the server-side, for example in a Next.js or Nuxt.js application. This way, you can render the content of your editor to HTML before sending it to the client, which can improve the performance of your application.

  Another use case is to render the content of your editor to another format like markdown, which can be useful if you want to send it to a markdown-based API.

  But what makes it static? The static renderer doesn't require a browser or a DOM to render the content. It's a pure JavaScript function that takes a document (as JSON or Prosemirror Node instance) and returns the target format back.

  ## Example

  Render a Tiptap document to an HTML string:

  ```js
  import StarterKit from '@tiptap/starter-kit'
  import { renderToHTMLString } from '@tiptap/static-renderer'

  renderToHTMLString({
    extensions: [StarterKit], // using your extensions
    // we can map nodes and marks to HTML elements
    options: {
      nodeMapping: {
        // custom node mappings
      },
      markMapping: {
        // custom mark mappings
      },
      unhandledNode: ({ node }) => {
        // handle unhandled nodes
        return `[unknown node ${node.type.name}]`
      },
      unhandledMark: ({ mark }) => {
        // handle unhandled marks
        return `[unknown node ${mark.type.name}]`
      },
    },
    // the source content to render
    content: {
      type: 'doc',
      content: [
        {
          type: 'paragraph',
          content: [
            {
              type: 'text',
              text: 'Hello World!',
            },
          ],
        },
      ],
    },
  })
  // returns: '<p>Hello World!</p>'
  ```

  Render to a React component:

  ```js
  import StarterKit from '@tiptap/starter-kit'
  import { renderToReactElement } from '@tiptap/static-renderer'

  renderToReactElement({
    extensions: [StarterKit], // using your extensions
    // we can map nodes and marks to HTML elements
    options: {
      nodeMapping: {
        // custom node mappings
      },
      markMapping: {
        // custom mark mappings
      },
      unhandledNode: ({ node }) => {
        // handle unhandled nodes
        return `[unknown node ${node.type.name}]`
      },
      unhandledMark: ({ mark }) => {
        // handle unhandled marks
        return `[unknown node ${mark.type.name}]`
      },
    },
    // the source content to render
    content: {
      type: 'doc',
      content: [
        {
          type: 'paragraph',
          content: [
            {
              type: 'text',
              text: 'Hello World!',
            },
          ],
        },
      ],
    },
  })
  // returns a react node that, when evaluated, would be equivalent to: '<p>Hello World!</p>'
  ```

  There are a number of options available to customize the output, like custom node and mark mappings, or handling unhandled nodes and marks.

  ## API

  ### `renderToHTMLString`

  ```ts
  function renderToHTMLString(options: {
    extensions: Extension[]
    content: ProsemirrorNode | JSONContent
    options?: TiptapHTMLStaticRendererOptions
  }): string
  ```

  #### `renderToHTMLString` Options

  - `extensions`: An array of Tiptap extensions that are used to render the content.
  - `content`: The content to render. Can be a Prosemirror Node instance or a JSON representation of a Prosemirror document.
  - `options`: An object with additional options.
  - `options.nodeMapping`: An object that maps Prosemirror nodes to HTML strings.
  - `options.markMapping`: An object that maps Prosemirror marks to HTML strings.
  - `options.unhandledNode`: A function that is called when an unhandled node is encountered.
  - `options.unhandledMark`: A function that is called when an unhandled mark is encountered.

  ### `renderToReactElement`

  ```ts
  function renderToReactElement(options: {
    extensions: Extension[]
    content: ProsemirrorNode | JSONContent
    options?: TiptapReactStaticRendererOptions
  }): ReactElement
  ```

  #### `renderToReactElement` Options

  - `extensions`: An array of Tiptap extensions that are used to render the content.
  - `content`: The content to render. Can be a Prosemirror Node instance or a JSON representation of a Prosemirror document.
  - `options`: An object with additional options.
  - `options.nodeMapping`: An object that maps Prosemirror nodes to React components.
  - `options.markMapping`: An object that maps Prosemirror marks to React components.
  - `options.unhandledNode`: A function that is called when an unhandled node is encountered.
  - `options.unhandledMark`: A function that is called when an unhandled mark is encountered.

  ## How does it work?

  Each Tiptap node/mark extension can define a `renderHTML` method which is used to generate default mappings of Prosemirror nodes/marks to the target format. These can be overridden by providing custom mappings in the options. One thing to note is that the static renderer doesn't support node views automatically, so you need to provide a mapping for each node type that you want rendered as a node view. Here is an example of how you can render a node view as a React component:

  ```js
  import { Node } from '@tiptap/core'
  import { ReactNodeViewRenderer } from '@tiptap/react'
  import StarterKit from '@tiptap/starter-kit'
  import { renderToReactElement } from '@tiptap/static-renderer'

  // This component does not have a NodeViewContent, so it does not render it's children's rich text content
  function MyCustomComponentWithoutContent() {
    const [count, setCount] = React.useState(200)

    return (
      <div className='custom-component-without-content' onClick={() => setCount(a => a + 1)}>
        {count} This is a react component!
      </div>
    )
  }

  const CustomNodeExtensionWithoutContent = Node.create({
    name: 'customNodeExtensionWithoutContent',
    atom: true,
    renderHTML() {
      return ['div', { class: 'my-custom-component-without-content' }] as const
    },
    addNodeView() {
      return ReactNodeViewRenderer(MyCustomComponentWithoutContent)
    },
  })

  renderToReactElement({
    extensions: [StarterKit, CustomNodeExtensionWithoutContent],
    options: {
      nodeMapping: {
        // render the custom node with the intended node view React component
        customNodeExtensionWithoutContent: MyCustomComponentWithoutContent,
      },
    },
    content: {
      type: 'doc',
      content: [
        {
          type: 'customNodeExtensionWithoutContent',
        },
      ],
    },
  })
  // returns: <div class="my-custom-component-without-content">200 This is a react component!</div>
  ```

  But what if you want to render the rich text content of the node view? You can do that by providing a `NodeViewContent` component as a child of the node view component:

  ```js
  import { Node } from '@tiptap/core'
  import {
    NodeViewContent,
    ReactNodeViewContentProvider,
    ReactNodeViewRenderer
  } from '@tiptap/react'
  import StarterKit from '@tiptap/starter-kit'
  import { renderToReactElement } from '@tiptap/static-renderer'


  // This component does have a NodeViewContent, so it will render it's children's rich text content
  function MyCustomComponentWithContent() {
    return (
      <div className="custom-component-with-content">
        Custom component with content in React!
        <NodeViewContent />
      </div>
    )
  }


  const CustomNodeExtensionWithContent = Node.create({
    name: 'customNodeExtensionWithContent',
    content: 'text*',
    group: 'block',
    renderHTML() {
      return ['div', { class: 'my-custom-component-with-content' }, 0] as const
    },
    addNodeView() {
      return ReactNodeViewRenderer(MyCustomComponentWithContent)
    },
  })


  renderToReactElement({
    extensions: [StarterKit, CustomNodeExtensionWithContent],
    options: {
      nodeMapping: {
        customNodeExtensionWithContent: ({ children }) => {
          // To pass the content down into the NodeViewContent component, we need to wrap the custom component with the ReactNodeViewContentProvider
          return (
            <ReactNodeViewContentProvider content={children}>
              <MyCustomComponentWithContent />
            </ReactNodeViewContentProvider>
          )
        },
      },
    },
    content: {
      type: 'doc',
      content: [
        {
          type: 'customNodeExtensionWithContent',
          // rich text content
          content: [
            {
              type: 'text',
              text: 'Hello, world!',
            },
          ],
        },
      ],
    },
  })

  // returns: <div class="custom-component-with-content">Custom component with content in React!<div data-node-view-content="" style="white-space:pre-wrap">Hello, world!</div></div>
  // Note: The NodeViewContent component is rendered as a div with the attribute data-node-view-content, and the rich text content is rendered inside of it
  ```

### Patch Changes

- 1b4c82b: We are now using pnpm package aliases for versions to enable better version pinning for the monorepository
- 89bd9c7: Enforce type imports so that the bundler ignores TypeScript type imports when generating the index.js file of the dist directory
- 81bb134: Fixed a bug causing inline-styles to be parsed as strings for React
- 8c69002: Synced beta with stable features
- Updated dependencies [1b4c82b]
- Updated dependencies [1e91f9b]
- Updated dependencies [a92f4a6]
- Updated dependencies [8de8e13]
- Updated dependencies [20f68f6]
- Updated dependencies [5e957e5]
- Updated dependencies [89bd9c7]
- Updated dependencies [d0fda30]
- Updated dependencies [0e3207f]
- Updated dependencies [37913d5]
- Updated dependencies [28c5418]
- Updated dependencies [32958d6]
- Updated dependencies [12bb31a]
- Updated dependencies [9f207a6]
- Updated dependencies [412e1bd]
- Updated dependencies [062afaf]
- Updated dependencies [ff8eed6]
- Updated dependencies [704f462]
- Updated dependencies [95b8c71]
- Updated dependencies [8c69002]
- Updated dependencies [664834f]
- Updated dependencies [ac897e7]
- Updated dependencies [087d114]
- Updated dependencies [32958d6]
- Updated dependencies [fc17b21]
- Updated dependencies [62b0877]
- Updated dependencies [e20006b]
- Updated dependencies [5ba480b]
- Updated dependencies [d6c7558]
- Updated dependencies [062afaf]
- Updated dependencies [9ceeab4]
- Updated dependencies [32958d6]
- Updated dependencies [bf835b0]
- Updated dependencies [4e2f6d8]
- Updated dependencies [32958d6]
  - @tiptap/core@3.0.1
  - @tiptap/pm@3.0.1

## 3.0.0-beta.30

### Patch Changes

- @tiptap/core@3.0.0-beta.30
- @tiptap/pm@3.0.0-beta.30

## 3.0.0-beta.29

### Patch Changes

- @tiptap/core@3.0.0-beta.29
- @tiptap/pm@3.0.0-beta.29

## 3.0.0-beta.28

### Patch Changes

- @tiptap/core@3.0.0-beta.28
- @tiptap/pm@3.0.0-beta.28

## 3.0.0-beta.27

### Patch Changes

- Updated dependencies [412e1bd]
  - @tiptap/core@3.0.0-beta.27
  - @tiptap/pm@3.0.0-beta.27

## 3.0.0-beta.26

### Patch Changes

- Updated dependencies [5ba480b]
  - @tiptap/core@3.0.0-beta.26
  - @tiptap/pm@3.0.0-beta.26

## 3.0.0-beta.25

### Patch Changes

- Updated dependencies [4e2f6d8]
  - @tiptap/core@3.0.0-beta.25
  - @tiptap/pm@3.0.0-beta.25

## 3.0.0-beta.24

### Patch Changes

- @tiptap/core@3.0.0-beta.24
- @tiptap/pm@3.0.0-beta.24

## 3.0.0-beta.23

### Patch Changes

- @tiptap/core@3.0.0-beta.23
- @tiptap/pm@3.0.0-beta.23

## 3.0.0-beta.22

### Patch Changes

- @tiptap/core@3.0.0-beta.22
- @tiptap/pm@3.0.0-beta.22

## 3.0.0-beta.21

### Patch Changes

- Updated dependencies [813674c]
- Updated dependencies [fc17b21]
  - @tiptap/core@3.0.0-beta.21
  - @tiptap/pm@3.0.0-beta.21

## 3.0.0-beta.20

### Patch Changes

- @tiptap/core@3.0.0-beta.20
- @tiptap/pm@3.0.0-beta.20

## 3.0.0-beta.19

### Patch Changes

- Updated dependencies [9ceeab4]
  - @tiptap/core@3.0.0-beta.19
  - @tiptap/pm@3.0.0-beta.19

## 3.0.0-beta.18

### Patch Changes

- @tiptap/core@3.0.0-beta.18
- @tiptap/pm@3.0.0-beta.18

## 3.0.0-beta.17

### Patch Changes

- Updated dependencies [e20006b]
  - @tiptap/core@3.0.0-beta.17
  - @tiptap/pm@3.0.0-beta.17

## 3.0.0-beta.16

### Patch Changes

- Updated dependencies [ac897e7]
- Updated dependencies [bf835b0]
  - @tiptap/core@3.0.0-beta.16
  - @tiptap/pm@3.0.0-beta.16

## 3.0.0-beta.15

### Patch Changes

- Updated dependencies [087d114]
  - @tiptap/core@3.0.0-beta.15
  - @tiptap/pm@3.0.0-beta.15

## 3.0.0-beta.14

### Patch Changes

- Updated dependencies [95b8c71]
  - @tiptap/core@3.0.0-beta.14
  - @tiptap/pm@3.0.0-beta.14

## 3.0.0-beta.13

### Patch Changes

- @tiptap/core@3.0.0-beta.13
- @tiptap/pm@3.0.0-beta.13

## 3.0.0-beta.12

### Patch Changes

- @tiptap/core@3.0.0-beta.12
- @tiptap/pm@3.0.0-beta.12

## 3.0.0-beta.11

### Patch Changes

- 81bb134: Fixed a bug causing inline-styles to be parsed as strings for React
  - @tiptap/core@3.0.0-beta.11
  - @tiptap/pm@3.0.0-beta.11

## 3.0.0-beta.10

### Patch Changes

- @tiptap/core@3.0.0-beta.10
- @tiptap/pm@3.0.0-beta.10

## 3.0.0-beta.9

### Patch Changes

- @tiptap/core@3.0.0-beta.9
- @tiptap/pm@3.0.0-beta.9

## 3.0.0-beta.8

### Patch Changes

- @tiptap/core@3.0.0-beta.8
- @tiptap/pm@3.0.0-beta.8

## 3.0.0-beta.7

### Patch Changes

- Updated dependencies [d0fda30]
  - @tiptap/core@3.0.0-beta.7
  - @tiptap/pm@3.0.0-beta.7

## 3.0.0-beta.6

### Patch Changes

- @tiptap/core@3.0.0-beta.6
- @tiptap/pm@3.0.0-beta.6

## 3.0.0-beta.5

### Patch Changes

- 8c69002: Synced beta with stable features
- Updated dependencies [8c69002]
- Updated dependencies [62b0877]
  - @tiptap/core@3.0.0-beta.5
  - @tiptap/pm@3.0.0-beta.5

## 3.0.0-beta.4

### Patch Changes

- Updated dependencies [5e957e5]
- Updated dependencies [9f207a6]
  - @tiptap/core@3.0.0-beta.4
  - @tiptap/pm@3.0.0-beta.4

## 3.0.0-beta.3

### Patch Changes

- 1b4c82b: We are now using pnpm package aliases for versions to enable better version pinning for the monorepository
- Updated dependencies [1b4c82b]
  - @tiptap/core@3.0.0-beta.3
  - @tiptap/pm@3.0.0-beta.3

## 3.0.0-beta.2

## 3.0.0-beta.1

## 3.0.0-beta.0

## 3.0.0-next.8

## 3.0.0-next.7

### Patch Changes

- 89bd9c7: Enforce type imports so that the bundler ignores TypeScript type imports when generating the index.js file of the dist directory

## 3.0.0-next.6

### Major Changes

- 6a53bb2: # @tiptap/static-renderer

  The `@tiptap/static-renderer` package provides a way to render a Tiptap/ProseMirror document to any target format, like an HTML string, a React component, or even markdown. It does so, by taking the original JSON of a document (or document partial) and attempts to map this to the output format, by matching against a list of nodes & marks.

  ## Why Static Render?

  The main use case for static rendering is to render a Tiptap/ProseMirror document on the server-side, for example in a Next.js or Nuxt.js application. This way, you can render the content of your editor to HTML before sending it to the client, which can improve the performance of your application.

  Another use case is to render the content of your editor to another format like markdown, which can be useful if you want to send it to a markdown-based API.

  But what makes it static? The static renderer doesn't require a browser or a DOM to render the content. It's a pure JavaScript function that takes a document (as JSON or Prosemirror Node instance) and returns the target format back.

  ## Example

  Render a Tiptap document to an HTML string:

  ```js
  import StarterKit from '@tiptap/starter-kit'
  import { renderToHTMLString } from '@tiptap/static-renderer'

  renderToHTMLString({
    extensions: [StarterKit], // using your extensions
    // we can map nodes and marks to HTML elements
    options: {
      nodeMapping: {
        // custom node mappings
      },
      markMapping: {
        // custom mark mappings
      },
      unhandledNode: ({ node }) => {
        // handle unhandled nodes
        return `[unknown node ${node.type.name}]`
      },
      unhandledMark: ({ mark }) => {
        // handle unhandled marks
        return `[unknown node ${mark.type.name}]`
      },
    },
    // the source content to render
    content: {
      type: 'doc',
      content: [
        {
          type: 'paragraph',
          content: [
            {
              type: 'text',
              text: 'Hello World!',
            },
          ],
        },
      ],
    },
  })
  // returns: '<p>Hello World!</p>'
  ```

  Render to a React component:

  ```js
  import StarterKit from '@tiptap/starter-kit'
  import { renderToReactElement } from '@tiptap/static-renderer'

  renderToReactElement({
    extensions: [StarterKit], // using your extensions
    // we can map nodes and marks to HTML elements
    options: {
      nodeMapping: {
        // custom node mappings
      },
      markMapping: {
        // custom mark mappings
      },
      unhandledNode: ({ node }) => {
        // handle unhandled nodes
        return `[unknown node ${node.type.name}]`
      },
      unhandledMark: ({ mark }) => {
        // handle unhandled marks
        return `[unknown node ${mark.type.name}]`
      },
    },
    // the source content to render
    content: {
      type: 'doc',
      content: [
        {
          type: 'paragraph',
          content: [
            {
              type: 'text',
              text: 'Hello World!',
            },
          ],
        },
      ],
    },
  })
  // returns a react node that, when evaluated, would be equivalent to: '<p>Hello World!</p>'
  ```

  There are a number of options available to customize the output, like custom node and mark mappings, or handling unhandled nodes and marks.

  ## API

  ### `renderToHTMLString`

  ```ts
  function renderToHTMLString(options: {
    extensions: Extension[]
    content: ProsemirrorNode | JSONContent
    options?: TiptapHTMLStaticRendererOptions
  }): string
  ```

  #### `renderToHTMLString` Options

  - `extensions`: An array of Tiptap extensions that are used to render the content.
  - `content`: The content to render. Can be a Prosemirror Node instance or a JSON representation of a Prosemirror document.
  - `options`: An object with additional options.
  - `options.nodeMapping`: An object that maps Prosemirror nodes to HTML strings.
  - `options.markMapping`: An object that maps Prosemirror marks to HTML strings.
  - `options.unhandledNode`: A function that is called when an unhandled node is encountered.
  - `options.unhandledMark`: A function that is called when an unhandled mark is encountered.

  ### `renderToReactElement`

  ```ts
  function renderToReactElement(options: {
    extensions: Extension[]
    content: ProsemirrorNode | JSONContent
    options?: TiptapReactStaticRendererOptions
  }): ReactElement
  ```

  #### `renderToReactElement` Options

  - `extensions`: An array of Tiptap extensions that are used to render the content.
  - `content`: The content to render. Can be a Prosemirror Node instance or a JSON representation of a Prosemirror document.
  - `options`: An object with additional options.
  - `options.nodeMapping`: An object that maps Prosemirror nodes to React components.
  - `options.markMapping`: An object that maps Prosemirror marks to React components.
  - `options.unhandledNode`: A function that is called when an unhandled node is encountered.
  - `options.unhandledMark`: A function that is called when an unhandled mark is encountered.

  ## How does it work?

  Each Tiptap node/mark extension can define a `renderHTML` method which is used to generate default mappings of Prosemirror nodes/marks to the target format. These can be overridden by providing custom mappings in the options. One thing to note is that the static renderer doesn't support node views automatically, so you need to provide a mapping for each node type that you want rendered as a node view. Here is an example of how you can render a node view as a React component:

  ```js
  import { Node } from '@tiptap/core'
  import { ReactNodeViewRenderer } from '@tiptap/react'
  import StarterKit from '@tiptap/starter-kit'
  import { renderToReactElement } from '@tiptap/static-renderer'

  // This component does not have a NodeViewContent, so it does not render it's children's rich text content
  function MyCustomComponentWithoutContent() {
    const [count, setCount] = React.useState(200)

    return (
      <div className='custom-component-without-content' onClick={() => setCount(a => a + 1)}>
        {count} This is a react component!
      </div>
    )
  }

  const CustomNodeExtensionWithoutContent = Node.create({
    name: 'customNodeExtensionWithoutContent',
    atom: true,
    renderHTML() {
      return ['div', { class: 'my-custom-component-without-content' }] as const
    },
    addNodeView() {
      return ReactNodeViewRenderer(MyCustomComponentWithoutContent)
    },
  })

  renderToReactElement({
    extensions: [StarterKit, CustomNodeExtensionWithoutContent],
    options: {
      nodeMapping: {
        // render the custom node with the intended node view React component
        customNodeExtensionWithoutContent: MyCustomComponentWithoutContent,
      },
    },
    content: {
      type: 'doc',
      content: [
        {
          type: 'customNodeExtensionWithoutContent',
        },
      ],
    },
  })
  // returns: <div class="my-custom-component-without-content">200 This is a react component!</div>
  ```

  But what if you want to render the rich text content of the node view? You can do that by providing a `NodeViewContent` component as a child of the node view component:

  ```js
  import { Node } from '@tiptap/core'
  import {
    NodeViewContent,
    ReactNodeViewContentProvider,
    ReactNodeViewRenderer
  } from '@tiptap/react'
  import StarterKit from '@tiptap/starter-kit'
  import { renderToReactElement } from '@tiptap/static-renderer'


  // This component does have a NodeViewContent, so it will render it's children's rich text content
  function MyCustomComponentWithContent() {
    return (
      <div className="custom-component-with-content">
        Custom component with content in React!
        <NodeViewContent />
      </div>
    )
  }


  const CustomNodeExtensionWithContent = Node.create({
    name: 'customNodeExtensionWithContent',
    content: 'text*',
    group: 'block',
    renderHTML() {
      return ['div', { class: 'my-custom-component-with-content' }, 0] as const
    },
    addNodeView() {
      return ReactNodeViewRenderer(MyCustomComponentWithContent)
    },
  })


  renderToReactElement({
    extensions: [StarterKit, CustomNodeExtensionWithContent],
    options: {
      nodeMapping: {
        customNodeExtensionWithContent: ({ children }) => {
          // To pass the content down into the NodeViewContent component, we need to wrap the custom component with the ReactNodeViewContentProvider
          return (
            <ReactNodeViewContentProvider content={children}>
              <MyCustomComponentWithContent />
            </ReactNodeViewContentProvider>
          )
        },
      },
    },
    content: {
      type: 'doc',
      content: [
        {
          type: 'customNodeExtensionWithContent',
          // rich text content
          content: [
            {
              type: 'text',
              text: 'Hello, world!',
            },
          ],
        },
      ],
    },
  })

  // returns: <div class="custom-component-with-content">Custom component with content in React!<div data-node-view-content="" style="white-space:pre-wrap">Hello, world!</div></div>
  // Note: The NodeViewContent component is rendered as a div with the attribute data-node-view-content, and the rich text content is rendered inside of it
  ```

## 3.0.0-next.5

## 3.0.0-next.4

### Major Changes

- 6a53bb2: # @tiptap/static-renderer

  The `@tiptap/static-renderer` package provides a way to render a Tiptap/ProseMirror document to any target format, like an HTML string, a React component, or even markdown. It does so, by taking the original JSON of a document (or document partial) and attempts to map this to the output format, by matching against a list of nodes & marks.

  ## Why Static Render?

  The main use case for static rendering is to render a Tiptap/ProseMirror document on the server-side, for example in a Next.js or Nuxt.js application. This way, you can render the content of your editor to HTML before sending it to the client, which can improve the performance of your application.

  Another use case is to render the content of your editor to another format like markdown, which can be useful if you want to send it to a markdown-based API.

  But what makes it static? The static renderer doesn't require a browser or a DOM to render the content. It's a pure JavaScript function that takes a document (as JSON or Prosemirror Node instance) and returns the target format back.

  ## Example

  Render a Tiptap document to an HTML string:

  ```js
  import StarterKit from '@tiptap/starter-kit'
  import { renderToHTMLString } from '@tiptap/static-renderer'

  renderToHTMLString({
    extensions: [StarterKit], // using your extensions
    // we can map nodes and marks to HTML elements
    options: {
      nodeMapping: {
        // custom node mappings
      },
      markMapping: {
        // custom mark mappings
      },
      unhandledNode: ({ node }) => {
        // handle unhandled nodes
        return `[unknown node ${node.type.name}]`
      },
      unhandledMark: ({ mark }) => {
        // handle unhandled marks
        return `[unknown node ${mark.type.name}]`
      },
    },
    // the source content to render
    content: {
      type: 'doc',
      content: [
        {
          type: 'paragraph',
          content: [
            {
              type: 'text',
              text: 'Hello World!',
            },
          ],
        },
      ],
    },
  })
  // returns: '<p>Hello World!</p>'
  ```

  Render to a React component:

  ```js
  import StarterKit from '@tiptap/starter-kit'
  import { renderToReactElement } from '@tiptap/static-renderer'

  renderToReactElement({
    extensions: [StarterKit], // using your extensions
    // we can map nodes and marks to HTML elements
    options: {
      nodeMapping: {
        // custom node mappings
      },
      markMapping: {
        // custom mark mappings
      },
      unhandledNode: ({ node }) => {
        // handle unhandled nodes
        return `[unknown node ${node.type.name}]`
      },
      unhandledMark: ({ mark }) => {
        // handle unhandled marks
        return `[unknown node ${mark.type.name}]`
      },
    },
    // the source content to render
    content: {
      type: 'doc',
      content: [
        {
          type: 'paragraph',
          content: [
            {
              type: 'text',
              text: 'Hello World!',
            },
          ],
        },
      ],
    },
  })
  // returns a react node that, when evaluated, would be equivalent to: '<p>Hello World!</p>'
  ```

  There are a number of options available to customize the output, like custom node and mark mappings, or handling unhandled nodes and marks.

  ## API

  ### `renderToHTMLString`

  ```ts
  function renderToHTMLString(options: {
    extensions: Extension[]
    content: ProsemirrorNode | JSONContent
    options?: TiptapHTMLStaticRendererOptions
  }): string
  ```

  #### `renderToHTMLString` Options

  - `extensions`: An array of Tiptap extensions that are used to render the content.
  - `content`: The content to render. Can be a Prosemirror Node instance or a JSON representation of a Prosemirror document.
  - `options`: An object with additional options.
  - `options.nodeMapping`: An object that maps Prosemirror nodes to HTML strings.
  - `options.markMapping`: An object that maps Prosemirror marks to HTML strings.
  - `options.unhandledNode`: A function that is called when an unhandled node is encountered.
  - `options.unhandledMark`: A function that is called when an unhandled mark is encountered.

  ### `renderToReactElement`

  ```ts
  function renderToReactElement(options: {
    extensions: Extension[]
    content: ProsemirrorNode | JSONContent
    options?: TiptapReactStaticRendererOptions
  }): ReactElement
  ```

  #### `renderToReactElement` Options

  - `extensions`: An array of Tiptap extensions that are used to render the content.
  - `content`: The content to render. Can be a Prosemirror Node instance or a JSON representation of a Prosemirror document.
  - `options`: An object with additional options.
  - `options.nodeMapping`: An object that maps Prosemirror nodes to React components.
  - `options.markMapping`: An object that maps Prosemirror marks to React components.
  - `options.unhandledNode`: A function that is called when an unhandled node is encountered.
  - `options.unhandledMark`: A function that is called when an unhandled mark is encountered.

  ## How does it work?

  Each Tiptap node/mark extension can define a `renderHTML` method which is used to generate default mappings of Prosemirror nodes/marks to the target format. These can be overridden by providing custom mappings in the options. One thing to note is that the static renderer doesn't support node views automatically, so you need to provide a mapping for each node type that you want rendered as a node view. Here is an example of how you can render a node view as a React component:

  ```js
  import { Node } from '@tiptap/core'
  import { ReactNodeViewRenderer } from '@tiptap/react'
  import StarterKit from '@tiptap/starter-kit'
  import { renderToReactElement } from '@tiptap/static-renderer'

  // This component does not have a NodeViewContent, so it does not render it's children's rich text content
  function MyCustomComponentWithoutContent() {
    const [count, setCount] = React.useState(200)

    return (
      <div className='custom-component-without-content' onClick={() => setCount(a => a + 1)}>
        {count} This is a react component!
      </div>
    )
  }

  const CustomNodeExtensionWithoutContent = Node.create({
    name: 'customNodeExtensionWithoutContent',
    atom: true,
    renderHTML() {
      return ['div', { class: 'my-custom-component-without-content' }] as const
    },
    addNodeView() {
      return ReactNodeViewRenderer(MyCustomComponentWithoutContent)
    },
  })

  renderToReactElement({
    extensions: [StarterKit, CustomNodeExtensionWithoutContent],
    options: {
      nodeMapping: {
        // render the custom node with the intended node view React component
        customNodeExtensionWithoutContent: MyCustomComponentWithoutContent,
      },
    },
    content: {
      type: 'doc',
      content: [
        {
          type: 'customNodeExtensionWithoutContent',
        },
      ],
    },
  })
  // returns: <div class="my-custom-component-without-content">200 This is a react component!</div>
  ```

  But what if you want to render the rich text content of the node view? You can do that by providing a `NodeViewContent` component as a child of the node view component:

  ```js
  import { Node } from '@tiptap/core'
  import {
    NodeViewContent,
    ReactNodeViewContentProvider,
    ReactNodeViewRenderer
  } from '@tiptap/react'
  import StarterKit from '@tiptap/starter-kit'
  import { renderToReactElement } from '@tiptap/static-renderer'


  // This component does have a NodeViewContent, so it will render it's children's rich text content
  function MyCustomComponentWithContent() {
    return (
      <div className="custom-component-with-content">
        Custom component with content in React!
        <NodeViewContent />
      </div>
    )
  }


  const CustomNodeExtensionWithContent = Node.create({
    name: 'customNodeExtensionWithContent',
    content: 'text*',
    group: 'block',
    renderHTML() {
      return ['div', { class: 'my-custom-component-with-content' }, 0] as const
    },
    addNodeView() {
      return ReactNodeViewRenderer(MyCustomComponentWithContent)
    },
  })


  renderToReactElement({
    extensions: [StarterKit, CustomNodeExtensionWithContent],
    options: {
      nodeMapping: {
        customNodeExtensionWithContent: ({ children }) => {
          // To pass the content down into the NodeViewContent component, we need to wrap the custom component with the ReactNodeViewContentProvider
          return (
            <ReactNodeViewContentProvider content={children}>
              <MyCustomComponentWithContent />
            </ReactNodeViewContentProvider>
          )
        },
      },
    },
    content: {
      type: 'doc',
      content: [
        {
          type: 'customNodeExtensionWithContent',
          // rich text content
          content: [
            {
              type: 'text',
              text: 'Hello, world!',
            },
          ],
        },
      ],
    },
  })

  // returns: <div class="custom-component-with-content">Custom component with content in React!<div data-node-view-content="" style="white-space:pre-wrap">Hello, world!</div></div>
  // Note: The NodeViewContent component is rendered as a div with the attribute data-node-view-content, and the rich text content is rendered inside of it
  ```
