Implements full markdown editor application with: Backend (Go): - Cobra CLI with --data-dir, --port, --host flags - REST API for CRUD operations on markdown files - File storage on disk with flat structure - Logrus logging for all operations - Static asset serving for frontend - Comprehensive tests for CRUD and static assets Frontend (React + TypeScript + Tailwind): - Markdown editor with live GFM preview - File management UI (list, create, open, save, delete) - Theme system (Dark, Light, System) with persistence - Responsive design (320px to 1920px) - Component tests for core functionality Integration: - Full CRUD workflow from frontend to backend - Static asset serving verified - All tests passing (backend: 2/2, frontend: 6/6) Files added: - Backend: API handler, logger, server, tests - Frontend: Components, tests, config files - Build artifacts: compiled backend binary and frontend dist - Documentation: README and implementation summary
127 lines
1.9 KiB
Markdown
127 lines
1.9 KiB
Markdown
# WYSIWYG Markdown Editor
|
|
|
|
A markdown editor with live preview, file management, and theme switching.
|
|
|
|
## Features
|
|
|
|
- **Markdown Editor**: Write markdown with live GitHub Flavored Markdown preview
|
|
- **File Management**: Create, open, save, and delete markdown files
|
|
- **Theme System**: Dark, Light, and System themes
|
|
- **Responsive Design**: Works on desktop and mobile devices
|
|
|
|
## Running the Application
|
|
|
|
### Prerequisites
|
|
|
|
- Node.js (v18+)
|
|
- Go (v1.21+)
|
|
- npm or yarn
|
|
|
|
### Backend
|
|
|
|
```bash
|
|
# Build the backend
|
|
cd backend
|
|
make build
|
|
|
|
# Run the backend
|
|
./bin/markdown-editor
|
|
|
|
# Or with custom flags
|
|
./bin/markdown-editor --data-dir ./my-data --port 3000 --host 0.0.0.0
|
|
```
|
|
|
|
### Frontend
|
|
|
|
```bash
|
|
# Install dependencies
|
|
cd frontend
|
|
npm install
|
|
|
|
# Build the frontend
|
|
npm run build
|
|
|
|
# Run in development mode
|
|
npm run dev
|
|
```
|
|
|
|
### Running Both
|
|
|
|
1. Build the frontend:
|
|
```bash
|
|
cd frontend
|
|
npm run build
|
|
```
|
|
|
|
2. Run the backend (it will serve the built frontend):
|
|
```bash
|
|
cd backend
|
|
./bin/markdown-editor
|
|
```
|
|
|
|
3. Open your browser to `http://localhost:8080`
|
|
|
|
## Development
|
|
|
|
### Running Tests
|
|
|
|
```bash
|
|
# Backend tests
|
|
cd backend
|
|
make test
|
|
|
|
# Frontend tests
|
|
cd frontend
|
|
npm test
|
|
```
|
|
|
|
### Project Structure
|
|
|
|
```
|
|
backend/
|
|
cmd/
|
|
backend/
|
|
main.go
|
|
internal/
|
|
api/
|
|
api.go
|
|
logger/
|
|
logger.go
|
|
server/
|
|
server.go
|
|
tests/
|
|
api_test.go
|
|
go.mod
|
|
go.sum
|
|
Makefile
|
|
|
|
frontend/
|
|
src/
|
|
App.tsx
|
|
main.tsx
|
|
index.css
|
|
setupTests.ts
|
|
App.test.tsx
|
|
package.json
|
|
vite.config.ts
|
|
tailwind.config.js
|
|
postcss.config.js
|
|
tsconfig.json
|
|
index.html
|
|
|
|
Makefile
|
|
README.md
|
|
SPEC.md
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
- `GET /api/{filename}.md` - Get markdown file content
|
|
- `POST /api/{filename}.md` - Create a new markdown file
|
|
- `PUT /api/{filename}.md` - Update an existing markdown file
|
|
- `DELETE /api/{filename}.md` - Delete a markdown file
|
|
|
|
## License
|
|
|
|
MIT
|