Skip to content

Bug: editor.getMarkdown() Always Returns Empty String in Vue #7130

@kieuminhcanh

Description

@kieuminhcanh

Affected Packages

core, markdown

Version(s)

3.8.0

Bug Description

Here is the bug report written in English, maintaining the detailed and professional format for a GitHub Issue.


🐛 Bug: editor.getMarkdown() Always Returns Empty String in Nuxt 4.2

Bug Description

When utilizing editor.getMarkdown() on a Tiptap instance integrated within a Nuxt 4.2 application, the method consistently returns an empty string (""), regardless of the content entered into the editor. We have verified that the editor's input data is correctly formatted and contains content.

This issue breaks all save/serialization functionalities that rely on the Markdown format. The editor.getJSON() method works correctly and returns the full content of the editor state.

Environment

  • OS: [Windows 11]
  • Browser: [Chrome 141]
  • Framework: Nuxt
  • Nuxt Version: 4.2.x
  • Vue Version: 3.x

Steps to Reproduce

  1. Create a clean Nuxt 4.2 project and install Tiptap along with the necessary Markdown extension (tiptap-markdown).

  2. Initialize the Editor in a component:

    import { Editor } from '@tiptap/vue-3';
    import StarterKit from '@tiptap/starter-kit';
    import { Markdown } from '@tiptap/markdown'
    
    const editor = new Editor({
      extensions: [
        StarterKit,
        Markdown , // Must be correctly registered
        // ...
      ],
      content: '# Hello', // Initialize with valid content
    });
  3. After the editor is mounted or after typing content, execute the method:

    const markdownContent = editor.getMarkdown();
    console.log(markdownContent);

Notes/Possible Cause

This issue typically indicates that the TiptapMarkdown extension (the serializer) is either not correctly registered in the editor instance's extensions array, or there is an incompatibility/conflict in the Nuxt environment (e.g., SSR/CSR loading) preventing the serializer from being properly loaded by Tiptap.

Temporary Workaround

The only functional workaround is to save the JSON State (editor.getJSON()) and manually use a separate Markdown serialization library to convert the Tiptap JSON to Markdown.

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

The editor.getMarkdown() method should return the serialized Markdown content:

# Hello

Additional Context (Optional)

Current Behavior

The editor.getMarkdown() method returns:

""

Dependency Updates

  • Yes, I've updated all my dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Open SourceThe issue or pull reuqest is related to the open source packages of Tiptap.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions