fix: add TableKit to preserve GFM tables on updatePage

Closes #2

GFM tables were corrupted when using update_page because the
Markdown → HTML (marked) → ProseMirror JSON (generateJSON) flow did not
recognize <table>, <tr>, <th>, <td> elements. Adding TableKit from
@tiptap/extension-table registers the required schema so tables round-trip
correctly in both create and update flows.

Tested on Docmost 0.70.1. Fixes PR #6 from the original repo.
This commit is contained in:
2026-05-30 20:32:44 -06:00
parent 67e4c13102
commit 23fa372774

View File

@@ -1,9 +1,11 @@
import StarterKit from "@tiptap/starter-kit"; import StarterKit from "@tiptap/starter-kit";
import Image from "@tiptap/extension-image"; import Image from "@tiptap/extension-image";
import Link from "@tiptap/extension-link"; import Link from "@tiptap/extension-link";
import { TableKit } from "@tiptap/extension-table";
// Define extensions compatible with standard Markdown features // Define extensions compatible with standard Markdown features
// We use the default Tiptap extensions to handle basic content // We use the default Tiptap extensions to handle basic content
// TableKit is required for generateJSON to parse HTML tables from marked (GFM tables)
export const tiptapExtensions = [ export const tiptapExtensions = [
StarterKit.configure({ StarterKit.configure({
// Explicitly enable features that might be disabled in some contexts // Explicitly enable features that might be disabled in some contexts
@@ -16,4 +18,5 @@ export const tiptapExtensions = [
Link.configure({ Link.configure({
openOnClick: false, openOnClick: false,
}), }),
TableKit,
]; ];