feat(markdown-editor): implement wysiswyg markdown editor with live preview
- Build Go backend with Cobra CLI and REST API - CRUD operations for markdown files (GET, POST, PUT, DELETE) - File storage with flat .md file structure - Comprehensive logrus logging with JSON format - Static asset serving for frontend - Build React/TypeScript frontend with Tailwind CSS - Markdown editor with live GFM preview - File management UI (list, create, open, delete) - Theme system (Dark/Light/System) with persistence - Responsive design (320px mobile, 1920px desktop) - Add comprehensive test coverage - Backend: API, storage, and logger tests (13 tests passing) - Frontend: Editor and App component tests - Setup Nix development environment with Go, Node.js, and TypeScript
This commit is contained in:
125
README.md
Normal file
125
README.md
Normal file
@@ -0,0 +1,125 @@
|
||||
# Markdown Editor
|
||||
|
||||
A WYSIWYG Markdown Editor with live preview, built with Go backend and React/TypeScript frontend.
|
||||
|
||||
## Features
|
||||
|
||||
- **Markdown Editor** with live GitHub Flavored Markdown preview
|
||||
- **File Management**: Create, open, save, and delete markdown files
|
||||
- **Theme System**: Dark, Light, and System themes with persistence
|
||||
- **Responsive Design**: Works on desktop and mobile
|
||||
- **REST API**: Full CRUD operations for markdown files
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
.
|
||||
├── backend/
|
||||
│ ├── cmd/server/
|
||||
│ │ └── main.go
|
||||
│ ├── internal/
|
||||
│ │ ├── api/
|
||||
│ │ │ ├── server.go
|
||||
│ │ │ └── server_test.go
|
||||
│ │ └── storage/
|
||||
│ │ ├── storage.go
|
||||
│ │ └── storage_test.go
|
||||
│ ├── pkg/
|
||||
│ │ └── logger/
|
||||
│ │ └── logger.go
|
||||
│ └── go.mod
|
||||
├── frontend/
|
||||
│ ├── src/
|
||||
│ │ ├── components/
|
||||
│ │ ├── hooks/
|
||||
│ │ ├── lib/
|
||||
│ │ ├── types/
|
||||
│ │ ├── App.tsx
|
||||
│ │ ├── App.test.tsx
|
||||
│ │ ├── index.css
|
||||
│ │ └── index.tsx
|
||||
│ ├── public/
|
||||
│ ├── package.json
|
||||
│ ├── tsconfig.json
|
||||
│ └── tailwind.config.js
|
||||
├── flake.nix
|
||||
├── flake.lock
|
||||
└── SPEC.md
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Using Nix
|
||||
|
||||
The project uses Nix for development environment. Ensure you have Nix installed.
|
||||
|
||||
```bash
|
||||
# Start development shell
|
||||
nix-shell
|
||||
|
||||
# Run tests
|
||||
cd backend && go test ./...
|
||||
cd ../frontend && npm test
|
||||
```
|
||||
|
||||
### Backend
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
|
||||
# Run server with defaults
|
||||
go run cmd/server/main.go
|
||||
|
||||
# Run with custom settings
|
||||
go run cmd/server/main.go --data-dir ./data --port 8080 --host 127.0.0.1
|
||||
|
||||
# Run tests
|
||||
go test ./...
|
||||
```
|
||||
|
||||
### Frontend
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
|
||||
# Install dependencies (in nix-shell)
|
||||
npm install
|
||||
|
||||
# Start development server
|
||||
npm start
|
||||
|
||||
# Build for production
|
||||
npm run build
|
||||
|
||||
# Run tests
|
||||
npm test
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
- `GET /api/files` - List all markdown files
|
||||
- `POST /api/files` - Create a new file
|
||||
- `PUT /api/files/:filename` - Update a file
|
||||
- `DELETE /api/files/:filename` - Delete a file
|
||||
- `/` - Serve frontend (SPA fallback)
|
||||
- `/static/*` - Serve static assets
|
||||
|
||||
## Testing
|
||||
|
||||
Run all tests:
|
||||
|
||||
```bash
|
||||
# Backend
|
||||
cd backend && go test -v ./...
|
||||
|
||||
# Frontend
|
||||
cd frontend && npm test
|
||||
```
|
||||
|
||||
## Evaluation Checklist
|
||||
|
||||
- [ ] CLI starts with defaults
|
||||
- [ ] CRUD works end-to-end
|
||||
- [ ] Static assets are properly served
|
||||
- [ ] Theme switch & persistence
|
||||
- [ ] Responsive at 320px and 1920px
|
||||
Reference in New Issue
Block a user