Skip to content

Commit 3ca97fe

Browse files
committed
Update README with API documentation and usage examples
1 parent 294cda7 commit 3ca97fe

1 file changed

Lines changed: 162 additions & 10 deletions

File tree

README.md

Lines changed: 162 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,172 @@
11
# InkForge
2-
InkForge is a high-performance Markdown rendering engine designed for developers and AI systems. It converts Markdown content into high-quality image outputs with full support for standard Markdown syntax, LaTeX mathematical expressions (powered by KaTeX), and Mermaid diagrams including flowcharts and sequence diagrams.
32

4-
Built on a browser-level rendering pipeline, InkForge ensures consistent layout, pixel-perfect output, and cross-platform compatibility. It is ideal for AI-generated reports, knowledge base exports, automated documentation pipelines, and dynamic content cards.
3+
InkForge is a high-performance Markdown rendering engine designed for developers and AI systems. It converts Markdown content into high-quality image outputs with full support for standard Markdown syntax, LaTeX mathematical expressions (powered by KaTeX), syntax highlighting (powered by Prism), and Mermaid diagrams.
54

6-
The system supports high-concurrency deployment, browser pooling optimization, and containerized environments, making it suitable as an infrastructure component within AI agents or model platforms.
5+
Built on a browser-level rendering pipeline using Playwright, InkForge ensures consistent layout, pixel-perfect output, and cross-platform compatibility.
76

8-
Key features include:
7+
## Features
98

10-
✅ Markdown to PNG / JPG / WebP
9+
- **Markdown to Image** - Convert Markdown to PNG, JPEG, or WebP
10+
- **LaTeX Math** - Full support for inline and display math equations using KaTeX
11+
- **Syntax Highlighting** - Code blocks with syntax highlighting (Python, JavaScript, TypeScript, Go, Bash, etc.)
12+
- **Mermaid Diagrams** - Flowcharts, sequence diagrams, and more
13+
- **Theme Support** - Light and dark themes
14+
- **High Resolution** - Configurable scale factor for retina-quality output
15+
- **API-First** - Easy integration via REST API
1116

12-
✅ Advanced mathematical formula rendering
17+
## Quick Start
1318

14-
✅ Mermaid diagram support
19+
### Run with Docker
1520

16-
✅ High-resolution and theme customization
21+
```bash
22+
docker run -d -p 8080:8080 insmtx/inkforge
23+
```
1724

18-
✅ API-first microservice architecture
25+
### Run from Source
1926

20-
InkForge aims to serve as a foundational document-to-visual rendering engine for the AI era.
27+
```bash
28+
# Install dependencies
29+
go mod download
30+
31+
# Build
32+
go build -o inkforge ./cmd/inkforge/
33+
34+
# Run
35+
./inkforge
36+
```
37+
38+
The server will start at `http://localhost:8080`
39+
40+
## Demo
41+
42+
Open `http://localhost:8080` in your browser to access the interactive demo page.
43+
44+
## API Usage
45+
46+
### Convert Markdown to Image
47+
48+
**Endpoint:** `POST /api/v1/markdown2image`
49+
50+
**Request:**
51+
52+
```json
53+
{
54+
"content": "# Hello World\n\nThis is **bold** and *italic* text.",
55+
"title": "My Document",
56+
"theme": "light",
57+
"image_format": "png",
58+
"width": 1200,
59+
"height": 800,
60+
"scale": 2.0
61+
}
62+
```
63+
64+
**Response:**
65+
66+
```json
67+
{
68+
"status": "success",
69+
"image_data": "<base64-encoded-image>",
70+
"image_format": "png",
71+
"size": {
72+
"width": 1200,
73+
"height": 800
74+
},
75+
"duration_ms": 1500
76+
}
77+
```
78+
79+
### cURL Example
80+
81+
```bash
82+
curl -X POST http://localhost:8080/api/v1/markdown2image \
83+
-H "Content-Type: application/json" \
84+
-d '{
85+
"content": "# Hello\n\n$$E=mc^2$$",
86+
"title": "Math Test",
87+
"image_format": "png"
88+
}' \
89+
--output output.png
90+
```
91+
92+
### Generate HTML (Debug)
93+
94+
**Endpoint:** `POST /api/v1/generatehtml`
95+
96+
Returns the generated HTML for debugging purposes.
97+
98+
### Health Check
99+
100+
**Endpoint:** `GET /api/v1/health`
101+
102+
Returns `{"status": "ok"}` when the service is running.
103+
104+
## Request Parameters
105+
106+
| Parameter | Type | Default | Description |
107+
|-----------|------|---------|-------------|
108+
| content | string | required | Markdown content to convert |
109+
| title | string | "" | Document title |
110+
| theme | string | "light" | Theme: "light" or "dark" |
111+
| image_format | string | "png" | Output format: "png", "jpg", "webp" |
112+
| width | int | 1200 | Image width in pixels |
113+
| height | int | 800 | Image height in pixels |
114+
| scale | float | 2.0 | Scale factor for high-DPI (2.0 = 2x) |
115+
| quality | int | 90 | JPEG/WebP quality (1-100) |
116+
| css | string | "" | Custom CSS styles |
117+
118+
## Supported Markdown Features
119+
120+
### Code Blocks
121+
122+
````markdown
123+
```python
124+
def hello():
125+
print("Hello!")
126+
```
127+
````
128+
129+
Supported languages: Python, JavaScript, TypeScript, Go, Bash, JSON, and more.
130+
131+
### Math Equations
132+
133+
Inline: `$E=mc^2$`
134+
135+
Display:
136+
```
137+
$$
138+
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
139+
$$
140+
```
141+
142+
### Mermaid Diagrams
143+
144+
````markdown
145+
```mermaid
146+
graph TD
147+
A[Start] --> B{Decision}
148+
B -->|Yes| C[Process]
149+
B -->|No| D[End]
150+
```
151+
````
152+
153+
### Tables
154+
155+
````markdown
156+
| Column 1 | Column 2 |
157+
|----------|----------|
158+
| Cell 1 | Cell 2 |
159+
````
160+
161+
## Architecture
162+
163+
- **Gin** - Web framework
164+
- **Playwright** - Browser-based rendering
165+
- **KaTeX** - LaTeX math rendering
166+
- **Prism** - Syntax highlighting
167+
- **Mermaid** - Diagram rendering
168+
- **gomarkdown** - Markdown parsing
169+
170+
## License
171+
172+
MIT License - see LICENSE file for details.

0 commit comments

Comments
 (0)