Skip to content

Commit 4d8f2fb

Browse files
Update markdown editor
1 parent cb5e2fa commit 4d8f2fb

3 files changed

Lines changed: 50 additions & 19 deletions

File tree

examples/markdown_editor/README.md

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,32 @@ A Word-style WYSIWYG document editor with a Markdown backend, built entirely in
2020

2121
## Running the App
2222

23-
### 1. Install dependencies
23+
### Quick Start
2424

2525
```bash
2626
cd examples/markdown_editor
27-
dart pub get
27+
./run.sh
2828
```
2929

30-
### 2. Compile to JavaScript
30+
Then open http://localhost:8080 in your browser.
31+
32+
### Using npm scripts
3133

3234
```bash
33-
dart compile js web/app.dart -o web/build/app.js
35+
cd examples/markdown_editor
36+
dart pub get
37+
npm start
3438
```
3539

36-
### 3. Serve the app
37-
38-
Use any static file server to serve the `web/` directory:
40+
### Manual steps
3941

4042
```bash
41-
# Using Python
42-
python3 -m http.server 8080 -d web
43-
44-
# Using Node.js (npx)
45-
npx serve web
46-
47-
# Using PHP
48-
php -S localhost:8080 -t web
43+
cd examples/markdown_editor
44+
dart pub get
45+
dart compile js web/app.dart -o web/build/app.js
46+
npx serve web -p 8080
4947
```
5048

51-
### 4. Open in browser
52-
53-
Navigate to `http://localhost:8080` (or whatever port your server uses).
54-
5549
## Project Structure
5650

5751
```
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "markdown-editor",
3+
"version": "0.1.0",
4+
"description": "Word-style document editor with Markdown backend (Dart + React)",
5+
"scripts": {
6+
"build": "dart compile js web/app.dart -o web/build/app.js",
7+
"serve": "npx serve web -p 8080",
8+
"start": "npm run build && npm run serve",
9+
"dev": "npm run build && npm run serve"
10+
},
11+
"devDependencies": {
12+
"serve": "^14.2.1"
13+
}
14+
}

examples/markdown_editor/run.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -e
3+
cd "$(dirname "$0")"
4+
5+
echo "=== Markdown Editor ==="
6+
echo ""
7+
8+
# Get Dart dependencies if needed
9+
if [ ! -d ".dart_tool" ]; then
10+
echo "Getting Dart dependencies..."
11+
dart pub get
12+
fi
13+
14+
# Build the app
15+
echo "Building app..."
16+
dart compile js web/app.dart -o web/build/app.js -O2
17+
18+
# Serve it
19+
echo ""
20+
echo "Starting server on http://localhost:8080"
21+
echo "Press Ctrl+C to stop"
22+
echo ""
23+
npx serve web -p 8080

0 commit comments

Comments
 (0)