Skip to content

Commit b99d07d

Browse files
docs: update Docker install commands and local static server URLs
1 parent 15eafb0 commit b99d07d

12 files changed

Lines changed: 1491 additions & 1787 deletions

README.md

Lines changed: 349 additions & 131 deletions
Large diffs are not rendered by default.

wiki/Configuration.md

Lines changed: 90 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,101 @@
1-
# Configuration
1+
# System & Build Configuration
22

3-
This page documents all configuration files and customizable settings in **Markdown Viewer**.
3+
This page details the configuration variables, local storage structures, container files, and desktop configuration parameters for **Markdown Viewer** (v3.7.4).
44

55
---
66

77
## Table of Contents
88

9-
- [Web Application](#web-application)
10-
- [Docker / Nginx](#docker--nginx)
11-
- [Docker Compose](#docker-compose)
12-
- [Desktop App — neutralino.config.json](#desktop-app--neutralinoconfigjson)
13-
- [Desktop App — package.json Scripts](#desktop-app--packagejson-scripts)
9+
- [Client-Side LocalStorage Keys](#client-side-localstorage-keys)
10+
- [CDN Library Integrations](#cdn-library-integrations)
11+
- [Nginx Container Configuration](#nginx-container-configuration)
12+
- [Docker Compose Service Schema](#docker-compose-service-schema)
13+
- [NeutralinoJS Desktop Configuration](#neutralinojs-desktop-configuration)
14+
- [Desktop App Package Scripts](#desktop-app-package-scripts)
1415
- [GitHub Actions Workflows](#github-actions-workflows)
15-
- [Transparency & Data Flow](#transparency--data-flow)
1616

1717
---
1818

19-
## Web Application
19+
## Client-Side LocalStorage Keys
2020

21-
The web application has no server-side or build-time configuration. User preferences are stored in the browser's **`localStorage`** and persist across sessions.
21+
The web application stores user preferences and document states directly in the browser's `localStorage`.
2222

23-
### localStorage Keys
24-
25-
| Key | Type | Description |
26-
|-----|------|-------------|
27-
| `theme` | `"light"` \| `"dark"` | Active color theme |
28-
| `syncScroll` | `"true"` \| `"false"` | Synchronized scroll state |
29-
| `viewMode` | `"split"` \| `"editor"` \| `"preview"` | Active layout mode |
30-
| `editorContent` | `string` | Last editor content (autosaved) |
31-
32-
### CDN Library Versions
33-
34-
Library versions are defined inline in `index.html`. To pin or upgrade a library, edit the corresponding `<script>` or `<link>` tag:
35-
36-
```html
37-
<!-- Example: upgrading marked.js -->
38-
<script src="https://cdn.jsdelivr.net/npm/marked@9.1.6/marked.min.js"></script>
39-
```
40-
41-
Current library versions are documented in the [Home](Home) page technology table.
23+
| LocalStorage Key | Type | Default Value | Description |
24+
| :--- | :--- | :--- | :--- |
25+
| `theme` | `"light"` \| `"dark"` | System preference | Renders light or dark colors. |
26+
| `syncScroll` | `"true"` \| `"false"` | `"true"` | Controls editor-preview scroll sync. |
27+
| `viewMode` | `"split"` \| `"editor"` \| `"preview"` | `"split"` | Sets the default editing layout. |
28+
| `markdown_tabs` | `JSON string` | Sample tab schema | Array of document objects (ID, title, content, scroll position, view mode). |
4229

4330
---
4431

45-
## Transparency & Data Flow
32+
## CDN Library Integrations
4633

47-
Markdown Viewer is a static client-side app. Key data flows to be aware of:
34+
Markdown Viewer loads large dependencies from CDNs. To update a library or pin it to a specific version, modify the script or link tag in the head of `index.html`:
4835

49-
- **Local storage**: Editor content and preferences are stored in `localStorage`.
50-
- **CDN assets**: Libraries are loaded from public CDNs (cdnjs, jsDelivr).
51-
- **GitHub import**: Public file imports use `api.github.com` and `raw.githubusercontent.com`.
52-
- **Share links**: Shared documents are encoded into the URL hash and never uploaded.
53-
54-
To eliminate external network requests, replace CDN links in `index.html` with locally hosted files and rebuild the desktop resources with `node prepare.js`.
36+
| Library Name | Version | CDN Service Provider | Core URL |
37+
| :--- | :--- | :--- | :--- |
38+
| **Marked.js** | `9.1.6` | jsDelivr | `https://cdn.jsdelivr.net/npm/marked@9.1.6/marked.min.js` |
39+
| **Highlight.js** | `11.9.0` | cdnjs | `https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js` |
40+
| **DOMPurify** | `3.0.9` | jsDelivr | `https://cdn.jsdelivr.net/npm/dompurify@3.0.9/dist/purify.min.js` |
41+
| **MathJax** | `3.2.2` | jsDelivr | `https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-mml-chtml.js` |
42+
| **Mermaid** | `11.15.0` | jsDelivr | `https://cdn.jsdelivr.net/npm/mermaid@11.15.0/dist/mermaid.min.js` |
43+
| **jsPDF** | `2.5.1` | cdnjs | `https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js` |
44+
| **html2canvas** | `1.4.1` | cdnjs | `https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js` |
45+
| **Pako** | `2.1.0` | cdnjs | `https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js` |
46+
| **js-yaml** | `4.1.0` | cdnjs | `https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.1.0/js-yaml.min.js` |
47+
| **FileSaver.js** | `2.0.5` | cdnjs | `https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js` |
48+
| **Bootstrap** | `5.3.2` | jsDelivr | `https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.js` |
5549

5650
---
5751

58-
## Docker / Nginx
59-
60-
The `Dockerfile` builds a production image using `nginx:alpine`. The embedded Nginx configuration can be customized by modifying the `Dockerfile` before building.
61-
62-
### Default Nginx Settings
63-
64-
| Setting | Value | Description |
65-
|---------|-------|-------------|
66-
| Listen port | `80` | HTTP port inside the container |
67-
| Document root | `/usr/share/nginx/html` | Static file serving directory |
68-
| SPA routing | `try_files $uri $uri/ /index.html` | Fallback for client-side routing |
69-
| Static asset cache | `1 year` | `Cache-Control: public, immutable` |
70-
| X-Frame-Options | `SAMEORIGIN` | Prevents embedding in iframes |
71-
| X-Content-Type-Options | `nosniff` | Prevents MIME-type sniffing |
72-
73-
### Changing the Exposed Port
74-
75-
The container always listens on port `80` internally. Map it to a different host port via `-p`:
52+
## Nginx Container Configuration
7653

77-
```bash
78-
docker run -p 3000:80 ghcr.io/thisis-developer/markdown-viewer:latest
79-
```
54+
The container image is built using `nginx:alpine`. Static web files are served from `/usr/share/nginx/html/`.
8055

81-
### Serving at a Sub-Path
56+
### Embedded Nginx Configuration (`/etc/nginx/conf.d/default.conf`)
57+
```nginx
58+
server {
59+
listen 80;
60+
server_name localhost;
61+
root /usr/share/nginx/html;
62+
index index.html;
63+
64+
# SPA Routing Fallback
65+
location / {
66+
try_files $uri $uri/ /index.html;
67+
}
8268
83-
To serve the app at `/app/` instead of `/`, update the Nginx `location` block in the `Dockerfile`:
69+
# Static Assets Caching (1 year)
70+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
71+
expires 1y;
72+
add_header Cache-Control "public, immutable";
73+
}
8474
85-
```nginx
86-
location /app/ {
87-
alias /usr/share/nginx/html/;
88-
try_files $uri $uri/ /app/index.html;
75+
# Security Headers
76+
add_header X-Frame-Options "SAMEORIGIN" always;
77+
add_header X-Content-Type-Options "nosniff" always;
78+
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
8979
}
9080
```
9181

9282
---
9383

94-
## Docker Compose
84+
## Docker Compose Service Schema
9585

96-
The `docker-compose.yml` in the repository root:
86+
The `docker-compose.yml` file defines how the container runs locally:
9787

9888
```yaml
9989
services:
10090
markdown-viewer:
101-
image: ghcr.io/thisis-developer/markdown-viewer:latest
91+
image: ghcr.io/thisis-developer/markdown-viewer:sha-15eafb0
10292
container_name: markdown-viewer
10393
ports:
10494
- "8080:80"
10595
restart: unless-stopped
10696
```
10797
108-
### Configurable Fields
109-
110-
| Field | Default | Description |
111-
|-------|---------|-------------|
112-
| `image` | `ghcr.io/…:latest` | Docker image to use |
113-
| `container_name` | `markdown-viewer` | Container name |
114-
| `ports` | `8080:80` | Host-to-container port mapping |
115-
| `restart` | `unless-stopped` | Container restart policy |
116-
117-
To build and use a local image instead of the published one, replace the `image` field with a `build` section:
118-
98+
To build and run a local image instead of pulling the pre-built container from the registry, replace the `image` key with `build: .`:
11999
```yaml
120100
services:
121101
markdown-viewer:
@@ -128,14 +108,14 @@ services:
128108

129109
---
130110

131-
## Desktop App — neutralino.config.json
111+
## NeutralinoJS Desktop Configuration
132112

133-
Located at `desktop-app/neutralino.config.json`.
113+
The desktop application uses the NeutralinoJS framework, which is configured in `desktop-app/neutralino.config.json`.
134114

135-
```jsonc
115+
```json
136116
{
137-
"applicationId": "js.neutralino.sample",
138-
"version": "1.0.0",
117+
"applicationId": "js.neutralino.markdownviewer",
118+
"version": "1.2.0",
139119
"defaultMode": "window",
140120
"enableServer": true,
141121
"enableNativeAPI": true,
@@ -152,10 +132,10 @@ Located at `desktop-app/neutralino.config.json`.
152132
],
153133
"window": {
154134
"title": "Markdown Viewer",
155-
"width": 800,
156-
"minWidth": 600,
157-
"height": 500,
158-
"minHeight": 400,
135+
"width": 1000,
136+
"minWidth": 800,
137+
"height": 700,
138+
"minHeight": 500,
159139
"resizable": true,
160140
"maximize": false,
161141
"center": true
@@ -177,58 +157,38 @@ Located at `desktop-app/neutralino.config.json`.
177157
}
178158
```
179159

180-
### Key Configuration Options
181-
182-
| Field | Description |
183-
|-------|-------------|
184-
| `applicationId` | Unique application identifier (reverse-domain format) |
185-
| `version` | Application version string |
186-
| `defaultMode` | Launch mode: `window`, `browser`, `cloud`, or `chrome` |
187-
| `window.width` / `window.height` | Initial window dimensions in pixels |
188-
| `window.minWidth` / `window.minHeight` | Minimum resizable dimensions |
189-
| `window.center` | Whether to center the window on launch |
190-
| `cli.binaryName` | Output binary name prefix |
191-
| `cli.binaryVersion` | Neutralinojs runtime version to use |
160+
### Key Window Settings
161+
* `width` / `height`: The default launch window size in pixels ($1000 \times 700$).
162+
* `minWidth` / `minHeight`: Restricts window scaling below $800 \times 500$ to prevent UI layout issues.
163+
* `nativeAllowList`: Grants the application permission to access OS and filesystem APIs (e.g. `filesystem.*` is required for loading and saving local files).
192164

193165
---
194166

195-
## Desktop App — package.json Scripts
167+
## Desktop App Package Scripts
196168

197-
Located at `desktop-app/package.json`.
169+
The `desktop-app/package.json` file contains scripts for development, packaging, and dependency updates:
198170

199-
| Script | Command | Description |
200-
|--------|---------|-------------|
201-
| `setup` | `node setup-binaries.js` | Download Neutralinojs binaries |
202-
| `dev` | `npx @neutralinojs/neu@11.7.0 run` | Start with hot-reload |
203-
| `build` | `node build-windows.js` | Build a Windows embedded single-file binary |
204-
| `build:windows` | `node build-windows.js` | Build a Windows embedded single-file binary |
205-
| `build:portable` | `npx @neutralinojs/neu@11.7.0 build --release --clean` | Build portable (resource-separated) binaries |
206-
| `build:all` | `npx @neutralinojs/neu@11.7.0 build --release --clean && node build-windows.js --dist dist/windows-embedded` | Build portable bundle plus Windows embedded binary |
171+
| Script Name | Command | Description |
172+
| :--- | :--- | :--- |
173+
| `setup` | `node setup-binaries.js` | Downloads Neutralino platform-specific runtimes. |
174+
| `dev` | `npx @neutralinojs/neu run` | Starts the desktop app in hot-reload development mode. |
175+
| `prepare` | `node prepare.js` | Copies core files from the project root into the desktop build directory. |
176+
| `build` | `node build-windows.js` | Compiles a single-file executable for Windows. |
177+
| `build:portable` | `npx @neutralinojs/neu build --release` | Packages the application into zip files for Windows, Linux, and macOS. |
207178

208179
---
209180

210181
## GitHub Actions Workflows
211182

212-
### docker-publish.yml
213-
214-
Located at `.github/workflows/docker-publish.yml`.
215-
216-
| Setting | Value |
217-
|---------|-------|
218-
| Trigger | Push to `main`, Pull requests |
219-
| Registry | `ghcr.io` |
220-
| Image name | `thisis-developer/markdown-viewer` |
221-
| Tags generated | `latest` (on main), branch name, PR number, commit SHA |
222-
| Platforms | `linux/amd64`, `linux/arm64` |
223-
224-
### desktop-build.yml
183+
The repository uses two GitHub Actions workflows:
225184

226-
Located at `.github/workflows/desktop-build.yml`.
185+
### 1. Docker Build & Publish (`docker-publish.yml`)
186+
* **Triggers:** Pushes to the `main` branch, or pull requests.
187+
* **Registry:** GitHub Container Registry (`ghcr.io`).
188+
* **Target Architectures:** `linux/amd64` and `linux/arm64` (multi-arch build).
189+
* **Tags:** `latest` for main branch releases, and commit-sha tags for development runs.
227190

228-
| Setting | Value |
229-
|---------|-------|
230-
| Trigger | Git tags matching `desktop-v*` |
231-
| Node.js version | LTS |
232-
| Build platforms | Windows x64, Linux x64, Linux ARM64, macOS Universal |
233-
| Artifacts | Embedded binaries + `checksums.sha256` |
234-
| GitHub Release | Created automatically with binaries as assets |
191+
### 2. Desktop Compiler (`desktop-build.yml`)
192+
* **Triggers:** Pushing Git tags that match the pattern `desktop-v*` (e.g. `desktop-v1.2.0`).
193+
* **Action:** Runs on Node LTS, runs the `setup`, `prepare`, and `build:portable` scripts, and generates checksums.
194+
* **Release:** Automatically creates a draft release on GitHub and uploads the compiled binaries as assets.

0 commit comments

Comments
 (0)