Skip to content

Workflow fire: convert Block Editor Markdown to ProseMirror JSON on save (server-side) #36002

Closed
0 of 1 issue completed

Description

@fmontes

Description

Today, when content is created or updated through the workflow fire endpoints (/api/v1/workflow/actions/**/fire, firemultipart, bulk fire), a Story Block (Block Editor) field value is stored in the database exactly as sent. If a client sends Markdown instead of a Tiptap/ProseMirror JSON document, dotCMS persists that raw string. The conversion to the proper ProseMirror object only happens later, client-side, when a human opens the contentlet in the editor and re-saves it.

This is a problem for non-interactive/automated content creation (AI agents via the MCP server, headless imports, migrations): the content looks broken to any consumer that reads the field as ProseMirror JSON (GraphQL, REST, SDK renderers) until a person manually opens and re-saves each contentlet.

What we want

On the workflow fire path, when a Story Block field's incoming value is Markdown (not already a valid Tiptap JSON document), the backend should convert it to a Tiptap/ProseMirror JSON object server-side and store that, so no human editor round-trip is required.

Why this is now feasible

PR #35728 (issue #35727) adds com.dotcms.tiptap.TiptapMarkdown, a bidirectional Tiptap-JSON ⇄ Markdown converter at the Java level — including the Markdown → Tiptap JSON direction (via commonmark-java). This provides the conversion primitive needed to do the transform during content save. This issue is about wiring that converter into the fire/save path.

Related work

Depends on #35728 being merged (or its TiptapMarkdown converter being available).

Acceptance Criteria

  • On the workflow fire endpoints, a Story Block field value supplied as Markdown is converted to a valid Tiptap/ProseMirror JSON document and stored as such.
  • A value that is already valid Tiptap/ProseMirror JSON is detected and stored unchanged (no double-conversion).
  • After firing with Markdown, the field reads back as structured ProseMirror JSON via GraphQL/REST/SDK without any human opening and re-saving the contentlet.
  • Conversion never throws on unknown/extended nodes or marks (consistent with the graceful-degradation behavior in feat(tiptap): convert Story Block content to Markdown (#35727) #35728).
  • Covered by tests (Markdown→stored-JSON through the fire endpoint).

Priority

Medium

Additional Context

Once this lands, the MCP server's existing guidance (telling agents to send Markdown for Block Editor fields) becomes fully correct with no human follow-up step. The fire endpoints already document that Block Editor fields accept Markdown.

Issue for HTML path (#36470)

Activity

  1. added theissue type on Jun 9, 2026
  2. self-assigned this
    on Jun 22, 2026
  3. github-actions commented on Jun 22, 2026

    @github-actions
    Contributor
  4. changed the title [-]Workflow fire: convert Block Editor HTML/Markdown to ProseMirror JSON on save (server-side)[/-] [+]Workflow fire: convert Block Editor Markdown to ProseMirror JSON on save (server-side)[/+] on Jul 10, 2026
  5. hmoreras commented on Jul 10, 2026

    @hmoreras
    Member

    ✅ QA — passed on modernization build (2026-07-10)

    Verified against the current AC (Markdown scope; HTML path tracked at #36470). Local
    dotCMS at localhost:8081, image dotcms/dotcms:modernization (built 2026-07-08).

    Method

    Two-step per AC: (a) fire a BlockContent with a body value in the shape the AC
    targets via PUT /api/v1/workflow/actions/default/fire/PUBLISH, then (b) read
    body_raw and query via GraphQL body { json } to confirm downstream consumers
    see structured JSON.

    Repro (bash + jq + curl) — click to expand
    # 1) Fire a Markdown body
    IDENT=$(curl -s -u admin@dotcms.com:admin -X PUT \
      "http://localhost:8081/api/v1/workflow/actions/default/fire/PUBLISH?indexPolicy=WAIT_FOR" \
      -H 'Content-Type: application/json' \
      -d '{"contentlet":{"contentType":"BlockContent","title":"qa-36002","body":"# H1\n\n- one\n- two\n\n`+"`"+`code`+"`"+`\n"}}' \
      | jq -r '.entity.identifier')
    
    # 2) Confirm stored as Tiptap JSON
    curl -s -u admin@dotcms.com:admin "http://localhost:8081/api/content/inode/$IDENT" \
      | jq -r '.contentlets[0].body_raw' | jq '.type'   # → "doc"
    
    # 3) Confirm GraphQL returns structured JSON
    Q="{ BlockContentCollection(query:\"+identifier:$IDENT\", limit:1){ body { json } } }"
    curl -s -u admin@dotcms.com:admin -X POST http://localhost:8081/api/v1/graphql \
      -H 'Content-Type: application/json' \
      -d "$(jq -n --arg q "$Q" '{query:$q}')" \
      | jq '.data.BlockContentCollection[0].body.json.type'   # → "doc"
  6. added 2 commits that reference this issue on Jul 16, 2026
    c1c40a4
    7028ef2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions