fossbook 0.2.11 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,509 +1,573 @@
|
|
|
1
|
-
# Fossbook
|
|
2
|
-
|
|
3
|
-
A
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
1
|
+
# Fossbook
|
|
2
|
+
|
|
3
|
+
A Markdown-based authoring and web-publishing tool for comics, illustrated
|
|
4
|
+
stories, and articles. Fossbook extends familiar Markdown with comic panels,
|
|
5
|
+
responsive layouts, image-linked dialogue, and reader-controlled transcripts,
|
|
6
|
+
then generates a complete static site that can be published on GitHub Pages.
|
|
7
|
+
|
|
8
|
+
Fossbook began as the publishing system for
|
|
9
|
+
[F/OSS Comics](https://fosscomics.com). It is now an independent Node.js
|
|
10
|
+
package for creators who want to keep words, artwork, translations, and site
|
|
11
|
+
configuration in portable source files rather than a proprietary editor.
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
_Artwork from [F/OSS Comics](https://fosscomics.com)._
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- **Comic authoring in Markdown** — Combine artwork, captions, dialogue,
|
|
20
|
+
narration, and links in readable text files
|
|
21
|
+
- **Panels and responsive layouts** — Arrange images or mixed-content comic
|
|
22
|
+
panels in grids that collapse for narrow screens
|
|
23
|
+
- **Accessible transcripts** — Associate dialogue with artwork and let readers
|
|
24
|
+
show or hide transcript text while keeping it available for printing
|
|
25
|
+
- **Image presentation controls** — Set image size, alignment, captions, panel
|
|
26
|
+
borders, dividers, backgrounds, and spacing with constrained Markdown syntax
|
|
27
|
+
- **Multilingual publishing** — Keep translations beside the original work and
|
|
28
|
+
generate language-specific pages, navigation, and `hreflang` metadata
|
|
29
|
+
- **Static web output** — Generate fast, portable HTML with pagination, tags,
|
|
30
|
+
SEO metadata, syntax highlighting, and Mermaid diagrams
|
|
31
|
+
- **Creator-owned workflow** — Store Markdown and artwork in Git, preview
|
|
32
|
+
locally, customize themes, and deploy to GitHub Pages
|
|
33
|
+
|
|
34
|
+
Fossbook also works as a conventional static blog generator. Its comic
|
|
35
|
+
extensions build on GitHub Flavored Markdown instead of replacing it.
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
### Install globally
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g fossbook
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Create a new publication
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
mkdir my-blog && cd my-blog
|
|
49
|
+
fossbook init
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This creates a publication project with the following structure:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
my-blog/
|
|
56
|
+
├── content/
|
|
57
|
+
│ ├── about.md
|
|
58
|
+
│ └── posts/
|
|
59
|
+
├── static/
|
|
60
|
+
│ └── images/
|
|
61
|
+
├── fossbook.config.js
|
|
62
|
+
└── package.json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Create a new work
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
fossbook new "My First Post"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This creates `content/posts/My First Post/index.md` with pre-filled front-matter
|
|
72
|
+
and an `images/` directory for comic panels, illustrations, and other artwork.
|
|
73
|
+
|
|
74
|
+
To create the default article and one or more configured translations together:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
fossbook new "My First Post" --lang ko,ja
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
This also creates `index.ko.md` and `index.ja.md` in the same post directory. Running the command again preserves existing files and creates only missing translations.
|
|
81
|
+
|
|
82
|
+
### Build the site
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
fossbook build
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Preview locally
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
fossbook serve
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Open http://localhost:3000 to view your site.
|
|
95
|
+
|
|
96
|
+
## Configuration
|
|
97
|
+
|
|
98
|
+
Create a `fossbook.config.js` in your project root:
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
module.exports = {
|
|
102
|
+
blogName: "My Blog",
|
|
103
|
+
authorName: "Your Name",
|
|
104
|
+
authorDescription: "A short bio",
|
|
105
|
+
authorWebsite: "https://example.com",
|
|
106
|
+
blogDescription: "A blog about things",
|
|
107
|
+
blogsite: "https://example.com",
|
|
108
|
+
|
|
109
|
+
// Optional
|
|
110
|
+
githubCNAME: "example.com",
|
|
111
|
+
googleAnalyticsID: "",
|
|
112
|
+
authorTwitter: "@you",
|
|
113
|
+
siteTwitter: "@yourblog",
|
|
114
|
+
githubRepository: "https://github.com/you/your-blog",
|
|
115
|
+
image: "https://example.com/default-image.png",
|
|
116
|
+
theme: "archie",
|
|
117
|
+
|
|
118
|
+
// Optional: URL prefix for posts. Defaults to "posts" -> /posts/<slug>/.
|
|
119
|
+
// Set to "" to serve posts at the site root, /<slug>/.
|
|
120
|
+
postsPath: "posts",
|
|
121
|
+
|
|
122
|
+
// Optional multilingual configuration
|
|
123
|
+
defaultLanguage: "en",
|
|
124
|
+
defaultLanguageInSubdir: false,
|
|
125
|
+
languages: {
|
|
126
|
+
en: { languageName: "English", locale: "en-US" },
|
|
127
|
+
ko: { languageName: "한국어", locale: "ko-KR" },
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
// Optional comments (see "Comments" below)
|
|
131
|
+
comments: {
|
|
132
|
+
provider: "utterances",
|
|
133
|
+
repo: "you/your-blog",
|
|
134
|
+
issueTerm: "pathname",
|
|
135
|
+
theme: "github-light",
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
// Directory overrides (defaults shown)
|
|
139
|
+
content: "./content",
|
|
140
|
+
postsDir: "./content/posts",
|
|
141
|
+
outputDir: "./public",
|
|
142
|
+
staticDir: "./static",
|
|
143
|
+
themesDir: "./themes",
|
|
144
|
+
};
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Content Format
|
|
148
|
+
|
|
149
|
+
Fossbook source remains readable Markdown. A work combines YAML front-matter,
|
|
150
|
+
prose, and standard GitHub Flavored Markdown with optional publishing
|
|
151
|
+
extensions for visual storytelling.
|
|
152
|
+
|
|
153
|
+
### Authoring comics
|
|
154
|
+
|
|
155
|
+
Keep each work and its artwork together. Standard Markdown images become comic
|
|
156
|
+
panels; image titles can control captions, size, and alignment. A blockquote
|
|
157
|
+
placed immediately after an image becomes its dialogue transcript:
|
|
158
|
+
|
|
159
|
+
```markdown
|
|
160
|
+

|
|
161
|
+
|
|
162
|
+
> "Do you think anyone will notice?" \
|
|
163
|
+
> "They always notice."
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Use `:::panel` containers to frame artwork, dialogue, and narration as one
|
|
167
|
+
scene. Use `:::panels` to compose responsive multi-column sequences:
|
|
168
|
+
|
|
169
|
+
```markdown
|
|
170
|
+
::::panels columns="2" label="Two scenes"
|
|
171
|
+
:::panel
|
|
172
|
+

|
|
173
|
+
|
|
174
|
+
> Dialogue for the first scene.
|
|
175
|
+
|
|
176
|
+
Narration following the first scene.
|
|
177
|
+
:::
|
|
178
|
+
|
|
179
|
+
:::panel divider="true"
|
|
180
|
+

|
|
181
|
+
|
|
182
|
+
> Dialogue for the second scene.
|
|
183
|
+
|
|
184
|
+
Narration following the dialogue.
|
|
185
|
+
:::
|
|
186
|
+
::::
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
The bundled theme adapts panel groups and sized images for mobile screens. It
|
|
190
|
+
also adds a transcript visibility control when a work contains image-linked
|
|
191
|
+
dialogue. Alternative text, captions, group labels, and transcript text remain
|
|
192
|
+
part of the authored source rather than being baked into the page layout.
|
|
193
|
+
|
|
194
|
+
See [Fossbook Markdown](fossbook_markdown.md) for the complete syntax for
|
|
195
|
+
panels, responsive groups, image presentation, dialogue, aligned links,
|
|
196
|
+
Mermaid diagrams, and syntax-highlighted code.
|
|
197
|
+
|
|
198
|
+
### Post front-matter
|
|
199
|
+
|
|
200
|
+
```markdown
|
|
201
|
+
---
|
|
202
|
+
title: My Post Title
|
|
203
|
+
date: 2026-02-17
|
|
204
|
+
description: "A brief summary of the post"
|
|
205
|
+
image: "feature.png"
|
|
206
|
+
tags: "JavaScript, Node.js, Static Site"
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
Your Markdown content here...
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Directory structure
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
content/posts/My Post Title/
|
|
216
|
+
├── index.md
|
|
217
|
+
└── images/
|
|
218
|
+
└── feature.png
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Post URLs
|
|
222
|
+
|
|
223
|
+
By default, posts are served under `/posts/`, e.g. `/posts/my-post-title/`. To
|
|
224
|
+
change the prefix or move posts to the site root, set `postsPath` in
|
|
225
|
+
`fossbook.config.js`:
|
|
226
|
+
|
|
227
|
+
```js
|
|
228
|
+
postsPath: "", // serves the post above at /my-post-title/ (site root)
|
|
229
|
+
// postsPath: "blog", // or use a different prefix: /blog/my-post-title/
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
This affects the generated output directory, the post URL, post links on the
|
|
233
|
+
home/all-posts/tag pages, and image paths. The on-disk source layout under
|
|
234
|
+
`content/posts/` does not change.
|
|
235
|
+
|
|
236
|
+
## Multilingual Sites
|
|
237
|
+
|
|
238
|
+
Fossbook generates a separate static page for each available language. The
|
|
239
|
+
browser loads only the selected language page; changing languages follows a
|
|
240
|
+
normal link and does not require JavaScript.
|
|
241
|
+
|
|
242
|
+
When a reader uses the language switcher, Fossbook remembers that choice in
|
|
243
|
+
the browser. A later visit to the default-language homepage redirects to the
|
|
244
|
+
remembered language's homepage. Direct links to posts and other pages are
|
|
245
|
+
never redirected, and language links continue to work when browser storage is
|
|
246
|
+
unavailable.
|
|
247
|
+
|
|
248
|
+
### Configuration
|
|
249
|
+
|
|
250
|
+
Add the languages supported by the site to `fossbook.config.js`:
|
|
251
|
+
|
|
252
|
+
```js
|
|
253
|
+
module.exports = {
|
|
254
|
+
defaultLanguage: "en",
|
|
255
|
+
defaultLanguageInSubdir: false,
|
|
256
|
+
languages: {
|
|
257
|
+
en: {
|
|
258
|
+
languageName: "English",
|
|
259
|
+
locale: "en-US",
|
|
260
|
+
},
|
|
261
|
+
ko: {
|
|
262
|
+
languageName: "한국어",
|
|
263
|
+
locale: "ko-KR",
|
|
264
|
+
},
|
|
265
|
+
ja: {
|
|
266
|
+
languageName: "日本語",
|
|
267
|
+
locale: "ja-JP",
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Put localized blog information in a sibling config file for each language. For
|
|
274
|
+
example, `fossbook.config.en.js` contains:
|
|
275
|
+
|
|
276
|
+
```js
|
|
277
|
+
module.exports = {
|
|
278
|
+
blogName: "My Blog",
|
|
279
|
+
authorName: "Jane Doe",
|
|
280
|
+
authorDescription: "Open source developer and writer",
|
|
281
|
+
blogDescription: "An English-language blog",
|
|
282
|
+
};
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
And `fossbook.config.ko.js` contains:
|
|
286
|
+
|
|
287
|
+
```js
|
|
288
|
+
module.exports = {
|
|
289
|
+
blogName: "나의 블로그",
|
|
290
|
+
authorName: "이수현",
|
|
291
|
+
authorDescription: "오픈 소스 개발자이자 작가",
|
|
292
|
+
blogDescription: "한국어 블로그",
|
|
293
|
+
homeLabel: "처음",
|
|
294
|
+
allPostsLabel: "모든 글",
|
|
295
|
+
aboutLabel: "이곳은",
|
|
296
|
+
tagsLabel: "태그",
|
|
297
|
+
allTagsLabel: "모든 태그",
|
|
298
|
+
postedOnLabel: "올린 날:",
|
|
299
|
+
readMoreLabel: "더 읽기",
|
|
300
|
+
previousPageLabel: "앞으로",
|
|
301
|
+
nextPageLabel: "뒤로",
|
|
302
|
+
transcriptLabel: "말글 보이기",
|
|
303
|
+
};
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
- `defaultLanguage` identifies the language represented by `index.md` and
|
|
307
|
+
`about.md`.
|
|
308
|
+
- `defaultLanguageInSubdir: false` keeps the default language at the site root.
|
|
309
|
+
Other languages are generated below their language code, such as `/ko/`.
|
|
310
|
+
- Set `defaultLanguageInSubdir: true` to generate the default language below
|
|
311
|
+
its code as well, such as `/en/`.
|
|
312
|
+
- Language config files use the main config filename with the language code
|
|
313
|
+
inserted before the extension: `fossbook.config.<language>.js`.
|
|
314
|
+
- Values omitted from a language config fall back to `fossbook.config.js`.
|
|
315
|
+
- `locale` controls language-specific date formatting.
|
|
316
|
+
- Language keys should use standard language tags such as `en`, `ko`, `ja`, or
|
|
317
|
+
`zh-Hant`.
|
|
318
|
+
|
|
319
|
+
If `languages` is omitted, Fossbook keeps its existing single-language
|
|
320
|
+
behavior and URLs.
|
|
321
|
+
|
|
322
|
+
### Create translated posts
|
|
323
|
+
|
|
324
|
+
Create only the default-language article:
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
fossbook new "Charles Babbage and Ada Lovelace"
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Create the default article and multiple translations together:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
fossbook new "Charles Babbage and Ada Lovelace" --lang ko,ja
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
The languages passed to `--lang` must be present in the `languages`
|
|
337
|
+
configuration. The command always ensures that the default `index.md` exists,
|
|
338
|
+
then creates the requested translation files. Existing Markdown files and
|
|
339
|
+
images are never overwritten, so the command can be run later to add another
|
|
340
|
+
translation:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
fossbook new "Charles Babbage and Ada Lovelace" --lang ja
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Source structure
|
|
347
|
+
|
|
348
|
+
Translations live in the same post bundle and share its `images/` directory:
|
|
349
|
+
|
|
350
|
+
```text
|
|
351
|
+
content/
|
|
352
|
+
├── about.md
|
|
353
|
+
├── about.ko.md
|
|
354
|
+
└── posts/
|
|
355
|
+
└── Charles Babbage and Ada Lovelace/
|
|
356
|
+
├── index.md
|
|
357
|
+
├── index.ko.md
|
|
358
|
+
├── index.ja.md
|
|
359
|
+
└── images/
|
|
360
|
+
└── feature.png
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
- `index.md` is the default-language article.
|
|
364
|
+
- `index.<language>.md` is a translated article.
|
|
365
|
+
- `about.md` is the default About page.
|
|
366
|
+
- `about.<language>.md` is a translated About page.
|
|
367
|
+
- A translation is generated only when its Markdown source exists. Fossbook
|
|
368
|
+
does not substitute default-language content for a missing translation.
|
|
369
|
+
|
|
370
|
+
### Generated output
|
|
371
|
+
|
|
372
|
+
With `defaultLanguage: "en"` and `defaultLanguageInSubdir: false`, the example
|
|
373
|
+
above generates:
|
|
374
|
+
|
|
375
|
+
```text
|
|
376
|
+
public/
|
|
377
|
+
├── index.html
|
|
378
|
+
├── about/index.html
|
|
379
|
+
├── posts/Charles Babbage and Ada Lovelace/index.html
|
|
380
|
+
├── ko/
|
|
381
|
+
│ ├── index.html
|
|
382
|
+
│ ├── about/index.html
|
|
383
|
+
│ └── posts/Charles Babbage and Ada Lovelace/index.html
|
|
384
|
+
└── ja/
|
|
385
|
+
├── index.html
|
|
386
|
+
└── posts/Charles Babbage and Ada Lovelace/index.html
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
Translated article and About pages display ISO language links such as `EN`,
|
|
390
|
+
`KO`, and `JA`. Only translations that exist are shown. These pages also emit
|
|
391
|
+
canonical URLs and `hreflang` alternate links for search engines.
|
|
392
|
+
|
|
393
|
+
### Mermaid diagrams
|
|
394
|
+
|
|
395
|
+
Fenced code blocks tagged `mermaid` are rendered as diagrams instead of code.
|
|
396
|
+
The [Mermaid](https://mermaid.js.org) script is loaded from a CDN only on pages
|
|
397
|
+
that contain a diagram.
|
|
398
|
+
|
|
399
|
+
````markdown
|
|
400
|
+
```mermaid
|
|
401
|
+
sequenceDiagram
|
|
402
|
+
Alice->>Bob: Hello Bob
|
|
403
|
+
Bob-->>Alice: Hi Alice
|
|
404
|
+
```
|
|
405
|
+
````
|
|
406
|
+
|
|
407
|
+
## CLI Reference
|
|
408
|
+
|
|
409
|
+
```
|
|
410
|
+
Usage: fossbook <command> [options]
|
|
411
|
+
|
|
412
|
+
Commands:
|
|
413
|
+
build Build the static site
|
|
414
|
+
serve Build and start a local dev server
|
|
415
|
+
new <title> Create a new post
|
|
416
|
+
init Create a new fossbook site project
|
|
417
|
+
|
|
418
|
+
Options:
|
|
419
|
+
-c, --config Path to config file (default: ./fossbook.config.js)
|
|
420
|
+
-o, --output Output directory (default: ./public)
|
|
421
|
+
-p, --port Dev server port (default: 3000)
|
|
422
|
+
--lang (new) Comma-separated translation languages, e.g. ko,ja
|
|
423
|
+
-v, --version Show version number
|
|
424
|
+
-h, --help Show help
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
## Theming
|
|
428
|
+
|
|
429
|
+
Fossbook ships with the Archie theme by default. To use a custom theme:
|
|
430
|
+
|
|
431
|
+
1. Create a `themes/<your-theme>/` directory in your project
|
|
432
|
+
2. Add `layouts/` (HTML templates) and `assets/` (CSS, fonts, images)
|
|
433
|
+
3. Set `theme: "your-theme"` in `fossbook.config.js`
|
|
434
|
+
|
|
435
|
+
Theme resolution order: user project `themes/` → built-in `themes/`.
|
|
436
|
+
|
|
437
|
+
## Comments
|
|
438
|
+
|
|
439
|
+
Fossbook supports [utterances](https://utteranc.es) — a commenting widget that
|
|
440
|
+
stores comments as GitHub issues. When enabled, a comment box is rendered at the
|
|
441
|
+
bottom of every post page.
|
|
442
|
+
|
|
443
|
+
### Setup
|
|
444
|
+
|
|
445
|
+
1. Make the repository that backs the comments **public**.
|
|
446
|
+
2. Install the [utterances GitHub App](https://github.com/apps/utterances) on
|
|
447
|
+
that repository so the bot can create issues.
|
|
448
|
+
3. Add a `comments` block to `fossbook.config.js`:
|
|
449
|
+
|
|
450
|
+
```js
|
|
451
|
+
comments: {
|
|
452
|
+
provider: "utterances", // currently the only supported provider
|
|
453
|
+
repo: "you/your-blog", // owner/repo that stores the comment issues
|
|
454
|
+
issueTerm: "pathname", // how a post maps to an issue (see below)
|
|
455
|
+
theme: "github-light", // any utterances theme, e.g. "github-dark"
|
|
456
|
+
},
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Omit the `comments` block (or set it to `null`) to disable comments.
|
|
460
|
+
|
|
461
|
+
### Options
|
|
462
|
+
|
|
463
|
+
| Field | Required | Default | Description |
|
|
464
|
+
| ----------- | -------- | ---------------- | ----------------------------------------------------------------------------- |
|
|
465
|
+
| `provider` | yes | — | Must be `"utterances"`. |
|
|
466
|
+
| `repo` | yes | — | `owner/repo` whose issues store the comments. |
|
|
467
|
+
| `issueTerm` | no | `"pathname"` | Mapping between a page and its issue: `pathname`, `url`, `title`, `og:title`. |
|
|
468
|
+
| `theme` | no | `"github-light"` | Any [utterances theme](https://utteranc.es/#configuration). |
|
|
469
|
+
|
|
470
|
+
### Mapping notes
|
|
471
|
+
|
|
472
|
+
With `issueTerm: "pathname"`, each post is matched to a GitHub issue whose title
|
|
473
|
+
equals the page's pathname (with the leading slash stripped). If you change a
|
|
474
|
+
post's URL, the existing comment thread no longer matches — rename the issue
|
|
475
|
+
title to the new pathname to keep the old comments.
|
|
476
|
+
|
|
477
|
+
### Required layout files
|
|
478
|
+
|
|
479
|
+
```
|
|
480
|
+
layouts/
|
|
481
|
+
├── home.html # Home page with pagination
|
|
482
|
+
├── post.html # Individual post page
|
|
483
|
+
├── page.html # Static pages (e.g., about)
|
|
484
|
+
├── all_posts.html # All posts listing
|
|
485
|
+
├── tag.html # Per-tag listing
|
|
486
|
+
├── tag_list.html # Tag index page
|
|
487
|
+
└── partials/
|
|
488
|
+
└── footer.html # Footer partial
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
## Deploying to GitHub Pages
|
|
492
|
+
|
|
493
|
+
Fossbook can automatically deploy your blog to GitHub Pages using GitHub Actions.
|
|
494
|
+
|
|
495
|
+
### Prerequisites: Install GitHub CLI (`gh`)
|
|
496
|
+
|
|
497
|
+
The `fossbook deploy` command uses the GitHub CLI to create repositories and monitor deployments.
|
|
498
|
+
|
|
499
|
+
**Linux (Debian/Ubuntu):**
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
sudo apt install gh
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
**macOS:**
|
|
506
|
+
|
|
507
|
+
```bash
|
|
508
|
+
brew install gh
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
**Windows:**
|
|
512
|
+
|
|
513
|
+
```bash
|
|
514
|
+
winget install GitHub.cli
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
Then authenticate with your GitHub account:
|
|
518
|
+
|
|
519
|
+
```bash
|
|
520
|
+
gh auth login
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
Follow the prompts to log in via browser or token.
|
|
524
|
+
|
|
525
|
+
### Initialize with GitHub
|
|
526
|
+
|
|
527
|
+
```bash
|
|
528
|
+
mkdir my-blog && cd my-blog
|
|
529
|
+
fossbook init --github
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
This will:
|
|
533
|
+
|
|
534
|
+
1. Scaffold the site project (config, content directories)
|
|
535
|
+
2. Create a GitHub repository for your blog
|
|
536
|
+
3. Generate `.github/workflows/deploy.yml` for automatic deployments
|
|
537
|
+
4. Push the initial commit to GitHub
|
|
538
|
+
|
|
539
|
+
### Publish a post
|
|
540
|
+
|
|
541
|
+
```bash
|
|
542
|
+
fossbook new "My New Article"
|
|
543
|
+
# ... edit content/posts/My New Article/index.md ...
|
|
544
|
+
fossbook deploy
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
Fossbook will build the site, commit, push to GitHub, wait for the CI/CD pipeline to finish, and display the live URL:
|
|
548
|
+
|
|
549
|
+
```
|
|
550
|
+
Building site... done.
|
|
551
|
+
Committing: "Publish: My New Article"
|
|
552
|
+
Pushing to origin/main...
|
|
553
|
+
Waiting for GitHub Pages deployment... ✓
|
|
554
|
+
|
|
555
|
+
✅ Published! View your article at:
|
|
556
|
+
https://username.github.io/my-blog/My%20New%20Article/
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
**Deploy options:**
|
|
560
|
+
|
|
561
|
+
```bash
|
|
562
|
+
fossbook deploy --message "Update homepage" # Custom commit message
|
|
563
|
+
fossbook deploy --no-wait # Push without waiting for CI
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
## License
|
|
567
|
+
|
|
568
|
+
- Generator code: [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
|
|
569
|
+
- Archie theme: [MIT License](https://github.com/athul/archie?tab=MIT-1-ov-file#readme)
|
|
570
|
+
|
|
571
|
+
## Credits
|
|
572
|
+
|
|
573
|
+
Adapted from [kartiknair's blog](https://github.com/kartiknair/blog) and styled using the [Archie theme](https://github.com/athul/archie).
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,45 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "fossbook",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "A
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "node bin/fossbook.js build",
|
|
8
|
-
"start": "node bin/fossbook.js serve",
|
|
9
|
-
"test": "mocha test",
|
|
10
|
-
"prettier": "prettier --write ."
|
|
11
|
-
},
|
|
12
|
-
"keywords": [
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "fossbook",
|
|
3
|
+
"version": "0.2.13",
|
|
4
|
+
"description": "A Markdown-based authoring and web-publishing tool for comics, illustrated stories, and articles",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "node bin/fossbook.js build",
|
|
8
|
+
"start": "node bin/fossbook.js serve",
|
|
9
|
+
"test": "mocha test",
|
|
10
|
+
"prettier": "prettier --write ."
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"comic-authoring",
|
|
14
|
+
"webcomics",
|
|
15
|
+
"publishing",
|
|
16
|
+
"static-site-generator",
|
|
17
|
+
"github-pages",
|
|
18
|
+
"markdown"
|
|
19
|
+
],
|
|
20
|
+
"author": "Joone Hur",
|
|
21
|
+
"license": "BSD-3-Clause",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"express": "^4.19.1",
|
|
24
|
+
"front-matter": "^4.0.2",
|
|
25
|
+
"highlight.js": "^11.9.0",
|
|
26
|
+
"marked": "^12.0.1"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"mocha": "^10.2.0",
|
|
30
|
+
"prettier": "^3.2.5"
|
|
31
|
+
},
|
|
32
|
+
"bin": {
|
|
33
|
+
"fossbook": "bin/fossbook.js"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=18"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"bin/",
|
|
40
|
+
"docs/images/",
|
|
41
|
+
"lib/",
|
|
42
|
+
"themes/"
|
|
43
|
+
],
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "https://github.com/joone/fossbook"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -461,6 +461,13 @@
|
|
|
461
461
|
margin-top: 0.75rem;
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
+
ul.pagination {
|
|
465
|
+
display: flex;
|
|
466
|
+
justify-content: center;
|
|
467
|
+
align-items: center;
|
|
468
|
+
padding-left: 0;
|
|
469
|
+
}
|
|
470
|
+
|
|
464
471
|
/* navigation */
|
|
465
472
|
h1.assistive-text {
|
|
466
473
|
display: none;
|
|
@@ -514,6 +521,10 @@
|
|
|
514
521
|
color: grey;
|
|
515
522
|
}
|
|
516
523
|
|
|
524
|
+
ul.posts .meta {
|
|
525
|
+
margin-left: 0.50rem;
|
|
526
|
+
}
|
|
527
|
+
|
|
517
528
|
/* Posts */
|
|
518
529
|
article .title {
|
|
519
530
|
margin-bottom: 1em;
|
|
@@ -553,6 +564,9 @@
|
|
|
553
564
|
display: flex;
|
|
554
565
|
justify-content: space-between;
|
|
555
566
|
}
|
|
567
|
+
.site-description + .list-item h1 {
|
|
568
|
+
margin-top: 1rem;
|
|
569
|
+
}
|
|
556
570
|
.post-tags ul.tags {
|
|
557
571
|
display: flex;
|
|
558
572
|
flex-wrap: wrap;
|