Skip to content

renderToMarkdown failed with table which has merged cells #7237

@ljmiaoo

Description

@ljmiaoo

Affected Packages

@tiptap/static-renderer

Version(s)

3.9.1

Bug Description

import { generateJSON } from "@tiptap/html/server";
import { renderToMarkdown } from "@tiptap/static-renderer/pm/markdown";
const htmlWithTable = `<table style="min-width: 75px">
    <colgroup>
        <col style="min-width: 25px">
        <col style="min-width: 25px">
        <col style="min-width: 25px">
    </colgroup>
    <tbody>
        <tr>
            <td colspan="1" rowspan="1">
                <p dir="auto">1</p>
            </td>
            <td colspan="1" rowspan="2">
                <p dir="auto">3</p>
            </td>
            <td colspan="1" rowspan="1">
                <p dir="auto">-</p>
            </td>
        </tr>
        <tr>
            <td colspan="1" rowspan="1">
                <p dir="auto">2</p>
            </td>
            <td colspan="1" rowspan="1">
                <p dir="auto">4</p>
            </td>
        </tr>
        <tr>
            <td colspan="1" rowspan="1"></td>
            <td colspan="1" rowspan="1"></td>
            <td colspan="1" rowspan="1"></td>
        </tr>
    </tbody>
</table>`
// extensions of table
const extensions = [...]
const doc = generateJSON(htmlWithTable, extensions);
const markdown = renderToMarkdown({
  extensions, // using your extensions
  content: doc,
});

console.log(markdown);

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

renderToMarkdown util generate wrong markdown content when table with merged cells。

Additional Context (Optional)

No response

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