Skip to content

Commit ad90801

Browse files
initial commit - first version of the App
Signed-off-by: Artur Kowalski <arthur@kyotutechnology.com>
0 parents  commit ad90801

33 files changed

+3955
-0
lines changed

.github/workflows/ci.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
name: Lint & Format
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Bun
18+
uses: oven-sh/setup-bun@v2
19+
with:
20+
bun-version: latest
21+
22+
- name: Install dependencies
23+
run: bun install
24+
25+
- name: Run ESLint
26+
run: bun run lint
27+
continue-on-error: true
28+
29+
- name: Check formatting
30+
run: bun run format:check
31+
continue-on-error: true
32+
33+
build:
34+
name: Build
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Setup Bun
41+
uses: oven-sh/setup-bun@v2
42+
with:
43+
bun-version: latest
44+
45+
- name: Install dependencies
46+
run: bun install
47+
48+
- name: Build
49+
run: bun run build
50+
51+
- name: Check build output
52+
run: |
53+
ls -la dist/
54+
test -f dist/index.html || exit 1
55+
test -f dist/app.js || exit 1
56+
57+
security:
58+
name: Security Scan
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@v4
63+
64+
- name: Run CodeQL Analysis
65+
uses: github/codeql-action/init@v4
66+
with:
67+
languages: javascript
68+
69+
- name: Autobuild
70+
uses: github/codeql-action/autobuild@v4
71+
72+
- name: Perform CodeQL Analysis
73+
uses: github/codeql-action/analyze@v4

.github/workflows/deploy.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to deploy (e.g., v1.0.0)'
10+
required: false
11+
default: 'dev'
12+
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: false
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Setup Bun
30+
uses: oven-sh/setup-bun@v2
31+
with:
32+
bun-version: latest
33+
34+
- name: Install dependencies
35+
run: bun install
36+
37+
- name: Get version
38+
id: version
39+
run: |
40+
if [ "${{ github.event_name }}" = "release" ]; then
41+
VERSION="${{ github.event.release.tag_name }}"
42+
elif [ "${{ github.event.inputs.version }}" != "" ] && [ "${{ github.event.inputs.version }}" != "dev" ]; then
43+
VERSION="${{ github.event.inputs.version }}"
44+
else
45+
VERSION="dev-$(git rev-parse --short HEAD)"
46+
fi
47+
echo "version=$VERSION" >> $GITHUB_OUTPUT
48+
echo "Building version: $VERSION"
49+
50+
- name: Build
51+
run: bun run build
52+
env:
53+
APP_VERSION: ${{ steps.version.outputs.version }}
54+
55+
- name: Inject version into HTML
56+
run: |
57+
VERSION="${{ steps.version.outputs.version }}"
58+
sed -i "s/__APP_VERSION__/$VERSION/g" dist/index.html
59+
echo "Injected version: $VERSION"
60+
61+
- name: Setup Pages
62+
uses: actions/configure-pages@v5
63+
64+
- name: Upload artifact
65+
uses: actions/upload-pages-artifact@v4
66+
with:
67+
path: './dist'
68+
69+
deploy:
70+
environment:
71+
name: github-pages
72+
url: ${{ steps.deployment.outputs.page_url }}
73+
runs-on: ubuntu-latest
74+
needs: build
75+
steps:
76+
- name: Deploy to GitHub Pages
77+
id: deployment
78+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
node_modules/
2+
dist/
3+
*.log
4+
5+
# IDE
6+
.idea/
7+
.vscode/
8+
*.swp
9+
*.swo
10+
11+
# OS
12+
.DS_Store
13+
Thumbs.db
14+
15+
# Environment
16+
.env
17+
.env.*
18+
19+
# Coverage & temp
20+
coverage/
21+
tmp/
22+
.cache/
23+
*.tgz
24+
25+
CLAUDE.md

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"semi": true,
3+
"singleQuote": false,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"printWidth": 100,
7+
"bracketSpacing": true
8+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 KYOTU Technology
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# MD2DOCX
2+
3+
Browser-based Markdown to DOCX/PDF/HTML converter with live preview, syntax highlighting, and Mermaid diagram support.
4+
5+
**[Live Demo](https://kyotu-technology.github.io/md2docx/)** · No installation required
6+
7+
---
8+
9+
## Features
10+
11+
- **Multi-format export** — DOCX, PDF, HTML (print-ready)
12+
- **Live preview** — Real-time rendering as you type
13+
- **Syntax highlighting** — 190+ languages via highlight.js
14+
- **Mermaid diagrams** — Flowcharts, sequence diagrams, etc.
15+
- **YAML frontmatter** — Title, author, date, TOC customization
16+
- **Themes** — KYOTU branded or minimal clean style
17+
- **Custom logo** — Upload your own for branded documents
18+
- **Auto-save** — Content persisted in localStorage
19+
- **Offline-capable** — Works entirely in the browser
20+
21+
## Quick Start
22+
23+
Visit **[kyotu-technology.github.io/md2docx](https://kyotu-technology.github.io/md2docx/)** and start typing.
24+
25+
Or run locally:
26+
27+
```bash
28+
git clone https://github.com/kyotu-technology/md2docx.git
29+
cd md2docx
30+
bun install
31+
bun run dev
32+
```
33+
34+
## Usage
35+
36+
### Frontmatter
37+
38+
```yaml
39+
---
40+
title: Project Documentation
41+
author: Your Name
42+
date: 2025-01-31
43+
toc-title: Contents
44+
---
45+
```
46+
47+
### Supported Markdown
48+
49+
| Element | Syntax |
50+
|---------|--------|
51+
| Headings | `# H1` through `#### H4` |
52+
| Emphasis | `**bold**`, `*italic*`, `***both***` |
53+
| Code | `` `inline` `` and fenced blocks with language |
54+
| Lists | Bullet, numbered, and `- [x]` task lists |
55+
| Tables | Pipe-delimited with header row |
56+
| Links | `[text](url)` |
57+
| Diagrams | ` ```mermaid ` code blocks |
58+
59+
### Mermaid Example
60+
61+
````markdown
62+
```mermaid
63+
graph LR
64+
A[Markdown] --> B[Parser]
65+
B --> C{Format?}
66+
C -->|DOCX| D[docx.js]
67+
C -->|PDF| E[pdfmake]
68+
C -->|HTML| F[Standalone]
69+
```
70+
````
71+
72+
## Export Options
73+
74+
Toggle in the settings panel (⚙️):
75+
76+
| Option | Default | Description |
77+
|--------|---------|-------------|
78+
| Title Page | On | Cover page with metadata |
79+
| Table of Contents | On | Auto-generated from headings |
80+
| Header | On | Logo in document header |
81+
| Footer | On | Page numbers, company info |
82+
83+
## Development
84+
85+
### Prerequisites
86+
87+
- [Bun](https://bun.sh/) v1.0+ (or Node.js 18+)
88+
89+
### Commands
90+
91+
```bash
92+
bun run dev # Start dev server at localhost:3000
93+
bun run build # Production build to dist/
94+
bun run lint # Run ESLint
95+
bun run format # Run Prettier
96+
```
97+
98+
### Project Structure
99+
100+
```
101+
md2docx/
102+
├── index.html # Main app shell
103+
├── build.js # Bun build script
104+
├── src/
105+
│ ├── main.js # App entry, UI logic
106+
│ ├── parser.js # Markdown → AST
107+
│ ├── docx-renderer.js # AST → DOCX
108+
│ ├── pdf-renderer.js # AST → PDF
109+
│ ├── html-export.js # AST → standalone HTML
110+
│ ├── html-preview.js # AST → preview HTML
111+
│ ├── highlighter.js # Code syntax highlighting
112+
│ ├── mermaid.js # Diagram rendering via Kroki
113+
│ └── themes/
114+
│ ├── kyotu.js # KYOTU branded theme
115+
│ └── minimal.js # Clean minimal theme
116+
└── assets/ # Logos, favicon
117+
```
118+
119+
## Tech Stack
120+
121+
| Component | Library |
122+
|-----------|---------|
123+
| DOCX generation | [docx](https://github.com/dolanmiu/docx) |
124+
| PDF generation | [pdfmake](https://pdfmake.github.io/docs/) |
125+
| Syntax highlighting | [highlight.js](https://highlightjs.org/) |
126+
| Diagrams | [Kroki.io](https://kroki.io/) |
127+
| Styling | [Tailwind CSS](https://tailwindcss.com/) (Play CDN) |
128+
| Build | [Bun](https://bun.sh/) |
129+
130+
## CI/CD
131+
132+
- **Pull requests** — ESLint, build verification, CodeQL security scan
133+
- **Releases** — Auto-deploy to GitHub Pages with version tag
134+
135+
## Contributing
136+
137+
1. Fork the repo
138+
2. Create a feature branch
139+
3. Make your changes
140+
4. Submit a PR
141+
142+
## License
143+
144+
MIT — see [LICENSE](LICENSE)
145+
146+
---
147+
148+
Built by [KYOTU Technology](https://kyotu.tech)

assets/KYOTU-sygnet-gradient.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)