Skip to content

About

HackMD-style markdown editor with live preview and Velt live sync, presence and text comments. React, Vite.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

HackMD-Style Markdown Editor with Velt: A markdown editor with live sync, presence and text comments

HackMD-Style Markdown Editor with Velt

A markdown editor with live sync, presence and text comments

A React markdown editor with a live preview, modelled on HackMD, where Velt Live State keeps the document in sync across users, with presence and text comments.


Built by Studio1 Built with Velt Live demo

Velt docs  ·  Velt  ·  More examples  ·  studio1hq.com


Overview

A HackMD-style markdown editor built with React and Velt. The left pane is a markdown editor and the right pane is a live preview. Velt Live State keeps the markdown in sync between users, VeltPresence shows who is in the document, and VeltComments in text mode lets users comment on selected text. A live demo is at hackmd-velt.vercel.app.

The base UI was generated in Antigravity from a screenshot of HackMD, then Velt was added.

Initial generated HackMD-style UI

More screenshots

UI follow-up

Adding Velt in Antigravity

Adding comments with Velt

Live sync integration

Antigravity coding, step 1

Antigravity coding, step 2

Antigravity coding, step 3

Features

  • Split editor and preview: A markdown editor on the left and a live rendered preview on the right, using react-markdown and remark-gfm.
  • Live sync: useLiveState('hackmd-clone-markdown', ...) shares the markdown across all users in real time.
  • Presence: VeltPresence in the header shows who is in the document.
  • Text comments: VeltComments in textMode for comments on selected text.
  • Demo users: Predefined users to test collaboration in two windows.
  • Toolbar and status bar: Editor toolbar, status bar and a default template document.

Tech stack

Layer Tool
Framework React, Vite, TypeScript
Collaboration Velt (@veltdev/react: Live State, Presence, Comments)
Markdown react-markdown, remark-gfm
Icons Lucide React
UI generation Google Antigravity
Deployment Vercel

Getting started

Prerequisites

Installation

git clone https://github.com/Studio1HQ/hackmd-clone.git
cd hackmd-clone
npm install

Environment variables

Create a .env file in the project root.

Variable Description
VITE_VELT_API_KEY Your Velt API key, from the Velt console.

Run

npm run dev

Vite prints the local URL. Other scripts: npm run build, npm run preview, npm run lint.

How it works

App.tsx wraps the app in VeltProvider, identifies the current user and sets the document to collaborative-hackmd-clone-2024. Layout.tsx holds the shared markdown in Velt Live State and passes it to the editor and preview:

const [markdown, setMarkdown] = useLiveState<string>('hackmd-clone-markdown', defaultMarkdown);
// <Editor value={markdown} onChange={setMarkdown} />
// <Preview content={markdown} />
src/
├── App.tsx                  # VeltProvider, identify, setDocument, VeltComments
├── components/
│   ├── Layout.tsx           # Live state, two-pane layout
│   ├── Header.tsx           # VeltPresence, user switcher
│   ├── Editor.tsx           # Markdown input
│   ├── Preview.tsx          # Rendered markdown
│   └── StatusBar.tsx
├── constants/defaultTemplate.ts
└── types/veltUser.ts

The UI was produced from a detailed prompt asking for a pixel-exact clone of a HackMD editor screenshot: two panes, dark mode, toolbar and visual-only GitHub and template buttons, with no routing, persistence or API calls.

Resources



Studio1

Built by Studio1, the technical content and DevRel partner for devtool teams. Made with Velt.
Browse more open-source examples at github.com/Studio1HQ.

Website Book a call X LinkedIn

studio1hq.com · Technical content, docs, video and DevRel for devtools

About

HackMD-style markdown editor with live preview and Velt live sync, presence and text comments. React, Vite.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages