Skip to content

Collaborative markdown#2556

Draft
micbar wants to merge 2 commits into
mainfrom
collaborative-markdown
Draft

Collaborative markdown#2556
micbar wants to merge 2 commits into
mainfrom
collaborative-markdown

Conversation

@micbar
Copy link
Copy Markdown
Member

@micbar micbar commented May 19, 2026

Description

Add an Y.js server to enable the collaborative mode of tiptap.

Details

  • Adds a hocuspocus container (Should be maintained in a separate repo)
  • Integrates it into the DEV Stack
  • Implements A WebDAV Storage Layer for Hocuspocus
  • Uses a webhook config to connect the tiptap editor with the hocuspocus server
  • Uses a Tiptap Editor instance on the Hocuspocus Server inside a JSDOM Tree to consolidate the write process to the storage in one location. This avoids that all editor instances need to synchronize and elect a leader who stores the data in markdown. This added layer is needed because of our markdown implementation, because we cannot sync the markdown between the different editor instances. Using an Editor Instance on the hocuspocus server makes the markdown conversion and storage more reliable and keeps the logic in hocuspocus instead of spreading it to all editor instances
  • Discovers the Token validation URL via openIDConnect Discovery to validate its access tokens
  • Uses the existing token from the pinia Store
  • Handles Write Conflicts to the markdown file and notifies the enduser by leveraging the WebDAV "If-Match" logic and by tracking etags
  • Implements a random color finder function for the user visualisations (called "collaboration-carets")

Related Issue

  • Fixes <issue_link>

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Types of changes

  • Bugfix
  • Enhancement (a change that doesn't break existing code or deployments)
  • Breaking change (a modification that affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

@micbar micbar force-pushed the collaborative-markdown branch from 92234a7 to ad5019d Compare May 19, 2026 14:39
@micbar micbar marked this pull request as draft May 19, 2026 14:40
@micbar
Copy link
Copy Markdown
Member Author

micbar commented May 19, 2026

@JammingBen
There seems to be a bug in my implementation.

Something regarding Token Handling or reconnects.

When my browser Tab is inactive for some time, the Editor Content is appended several times to the end of the document again and again.

@micbar
Copy link
Copy Markdown
Member Author

micbar commented May 19, 2026

@dschmidt
I am interested how your implementation differs from this.

@dschmidt
Copy link
Copy Markdown
Contributor

dschmidt commented May 19, 2026

Quite a bit 😅

The main difference is that I tried to keep the server as dumb as possible. I want it to do basic authentication and authorization and apart from that I want it to be universally usable by different yjs apps.
That's why most of the logic in my approach is on the client side.

I've tried to keep all connection handling, stale detection, client mismatch handling and all that in a reusable generic layer, so actual app implementation can stay very lean.

It's very much still work in progress too - but if you wanna take a first look ... feel free! :)

Happy to discuss the overall architecture.

FWIW I'm still online in Matrix 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants