Skip to content

Add prosemirror pkg to handle conversion from and to other formats#940

Draft
codenem wants to merge 10 commits intoepic/rich-editorfrom
codenem/prosemirror-structs
Draft

Add prosemirror pkg to handle conversion from and to other formats#940
codenem wants to merge 10 commits intoepic/rich-editorfrom
codenem/prosemirror-structs

Conversation

@codenem
Copy link
Copy Markdown
Contributor

@codenem codenem commented Mar 26, 2026

TODO

  • MD to prosemirror JSON cli
  • Does the frontend tiptap support all previous docs
  • Unwanted page breaks

Summary by cubic

Add pkg/prosemirror to parse ProseMirror/Tiptap JSON and render safe HTML for PDFs. Add a Markdown→ProseMirror converter and CLI tools for content migration; enable h1–h6 in the editor; switch pkg/docgen to ProseMirror, and fix unwanted PDF page breaks.

  • New Features

    • pkg/prosemirror: Node/Mark structs and RenderHTML(Node) that escapes HTML and adds language-* on code blocks. Supports paragraphs, headings (h1–h6), blockquote, horizontal rules, hard breaks, images, bullet/ordered lists, and tables (cells/headers with colspan/rowspan; colwidthmin-width). Marks: bold, italic, underline, strike, code, link (href/target/rel/class/title).
    • Markdown import: ParseMarkdown([]byte) builds ProseMirror JSON using github.com/yuin/goldmark for consistent lists, tables, code, and inline marks.
    • CLI: proboctl md-to-prosemirror (stdin → JSON), probo documentversion update-content to push JSON via the API, and migrate-document-versions-markdown to rewrite document_versions.content from Markdown to ProseMirror JSON.
    • Rich editor: enable headings up to h6, add Heading 4 to menus, and update CSS sizes for h1–h6.
    • Docs: added contrib/claude/go-style.md and linked it from AGENTS.md.
  • Refactors

    • pkg/docgen: render from ProseMirror JSON → HTML; template now uses .BodyHTML, styles blockquotes, and removes H2-based page-break CSS. On parse/render failure, fallback to a single escaped <p> with the raw input. Tests updated to expect ProseMirror HTML structure.
    • Dependencies: removed go.abhg.dev/goldmark/mermaid; upgraded github.com/yuin/goldmark to v1.8.2 and use it only in the Markdown→ProseMirror converter.

Written for commit 3815eec. Summary will update on new commits.

@codenem codenem force-pushed the codenem/prosemirror-structs branch from f7ccafc to 4008791 Compare March 26, 2026 15:20
Signed-off-by: Émile Ré <emile@getprobo.com>
@codenem codenem force-pushed the codenem/prosemirror-structs branch from 4008791 to 7fe271b Compare March 27, 2026 07:43
codenem added 5 commits March 27, 2026 11:43
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
DocumentData struct {
Title string
Content string
Content string // ProseMirror/Tiptap document JSON; use ProseMirrorJSONToHTML for HTML
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

json.RawMessage?

Signed-off-by: Émile Ré <emile@getprobo.com>
@codenem codenem changed the title Add prosemirror package for JSON parsing and HTML rendering Add prosemirror pkg to handle conversion from and to other formats Mar 27, 2026
Signed-off-by: Émile Ré <emile@getprobo.com>
@codenem codenem force-pushed the codenem/prosemirror-structs branch from 4a2b4d2 to 090fb11 Compare March 27, 2026 14:18
codenem added 2 commits March 27, 2026 19:04
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants