This is a simple collaborative Markdown editor built in React, with inline format preview and inline commenting.
It's built on automerge and automerge-repo for CRDT-based storage and sync. It uses Codemirror for markdown editing UI, and automerge-codemirror to connect to Codemirror.
![CleanShot 2023-11-08 at 14 15 49@2x](https://private-user-images.githubusercontent.com/934016/281518786-672e0642-0ecd-47f6-8595-be2629a4e265.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxNTIzOTIsIm5iZiI6MTcyMjE1MjA5MiwicGF0aCI6Ii85MzQwMTYvMjgxNTE4Nzg2LTY3MmUwNjQyLTBlY2QtNDdmNi04NTk1LWJlMjYyOWE0ZTI2NS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyOFQwNzM0NTJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mYjJjZWQ3OGM2ZjI3M2M0ZmIyMjlkMTY1Njk2OWQ5Y2E5ZDFjYTU5ODhlOWVhYzdjMmQyMWRkMDRjOTg4ZGRlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.vX7Dsgr7QF36_jeTr7YaCttTSS49eWwxwspNgcLgoZs)
If you visit the root domain the app will make a new doc. Or you can hit the New button.
Once you have a doc, the URL will update with a doc ID. If you share that URL to another browser/device, it should sync live. Hold on to the URL if you want to come back to that doc!
- Edit Markdown with inline format preview
- Write inline comments + replies
- Live sync through Automerge
- Stores data to local device
- Save out .md file with a Download button
- Typeset similarly to Ink & Switch essays
This app is primarily intended for internal use at Ink & Switch for editing essays, so there are some features that are specialized towards that use case. We don't plan to develop it into a general-purpose editor that anyone can use for anything. But of course, it can edit any Markdown document too. If you want to actually use this editor in earnest, you might want to fork it to build your own ideas.
Hopefully the code serves as a useful sample for building apps based on automerge-repo, automerge-codemirror, and React.
yarn
yarn dev
This app is designed for normal webapp deployment as well as experimental deployment to an internal I&S platform. The code is almost entirely shared but there are two entry points:
src/main.tsx
is the normal app entry pointsrc/index.ts
is an experimental entry point which just exports some functions to a host environment
This app is actually a general framework for editing automerge docs in viewers, which currently has specific support for markdown documents and tldraw whiteboards.
Basic instructions to add a new datatype:
- copy an existing
src/{datatype}
directory as a template.tee
is a reasonable example - Fill in
src/<your_datatype>/datatype.ts
with a TS type, an init function, and other functions - Add your new datatype to the
datatypes
map insrc/datatypes.ts