Skip to content

Commit b7b8567

Browse files
authored
docs: use mermaid on typedoc output (#32)
* Remove typedoc-plugin-mermaid and replace with a custom script * Add an example tasks.json for vscode * Add BUILDING.md as a shorter version of CONTRIBUTING.md * Mention transitive dependencies in NOTICE.md * Fix wording and broken links in doc/ * Also some refactoring that split some of longer classes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added BUILDING guide and startup helpers for editor/session flow. * **Documentation** * README, FAQ, design, NOTICE, typedoc and rendering updates; badges and changelog adjusted. * **Refactor** * Background/startup and editor/session orchestration reorganized for clearer flows. * **Chores** * CI uploader upgraded; dependency and tooling updates; schema and packaging/script adjustments. * **Developer Experience** * VS Code task examples and standardized test output paths added. * **Tests** * Improved test helpers and assertions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents de5e930 + 384fc7d commit b7b8567

31 files changed

Lines changed: 762 additions & 613 deletions

.github/workflows/doc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
uses: actions/configure-pages@v4
5252

5353
- name: Upload pages artifact
54-
uses: actions/upload-pages-artifact@v3
54+
uses: actions/upload-pages-artifact@v4
5555
with:
5656
path: build/doc
5757

.vscode/tasks.example.json

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "tsc:once",
6+
"type": "shell",
7+
"group": {
8+
"kind": "build",
9+
"isDefault": false
10+
},
11+
"problemMatcher": "$tsc",
12+
"isBackground": false,
13+
"command": "corepack",
14+
"args": [
15+
"yarn",
16+
"run",
17+
"check-type"
18+
]
19+
},
20+
{
21+
"label": "tsc:watch",
22+
"type": "shell",
23+
"group": {
24+
"kind": "build",
25+
"isDefault": false
26+
},
27+
"problemMatcher": "$tsc-watch",
28+
"isBackground": true,
29+
"command": "corepack",
30+
"args": [
31+
"yarn",
32+
"run",
33+
"check-type",
34+
"--watch"
35+
]
36+
},
37+
{
38+
"label": "tsdown:once",
39+
"type": "shell",
40+
"group": {
41+
"kind": "build",
42+
"isDefault": false
43+
},
44+
"problemMatcher": "$tsc",
45+
"isBackground": false,
46+
"command": "corepack",
47+
"args": [
48+
"yarn",
49+
"run",
50+
"tsdown"
51+
]
52+
},
53+
{
54+
"label": "tsdown:watch",
55+
"type": "shell",
56+
"group": {
57+
"kind": "build",
58+
"isDefault": false
59+
},
60+
"problemMatcher": "$tsc-watch",
61+
"isBackground": true,
62+
"command": "corepack",
63+
"args": [
64+
"yarn",
65+
"run",
66+
"tsdown",
67+
"--watch"
68+
]
69+
}
70+
]
71+
}

.web-ext-config.example.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
run: {
66
// You can use flatpak by specifying "flatpak:org.mozilla.Thunderbird"
77
firefox: "/usr/bin/thunderbird",
8-
firefoxProfile: "/home/your/.config/your-testing-thunderbird-profile",
8+
firefoxProfile: import.meta.dirname + "/.cache/thunderbird-testing-profile/",
99
profileCreateIfMissing: true,
1010
// keepProfileChanges: true,
1111
},

BUILDING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Building
2+
3+
* Ensure that you have Node.js LTS (v22+) and corepack installed.
4+
* Basically, running `make` will do, which is roughly equivalent to `yarn install && yarn build`.
5+
* A XPI file will appear in `dist/`.
6+
* See [CONTRIBUTING.md](./CONTRIBUTING.md) for details on tools and steps.
7+
* See [building.md](./doc/building.md) for details on build script internals.

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Contributing
22

33
* Feel free to open issues and submit pull requests.
4+
* See [Open source etiquette](https://developer.mozilla.org/docs/MDN/Community/Open_source_etiquette) for general guidelines.
45
* By contributing, you agree that your contributions will be [dual-licensed under MPL-2.0 OR GPL-3.0-or-later](./LICENSE).
56

67
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/exteditor/ghostbird?quickstart=1)

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Ghostbird: GhostText for Thunderbird :nest_with_eggs::mailbox::ghost:
22

3-
[![Supports Thunderbird ESR](https://img.shields.io/badge/supports-Thunderbird_140_ESR-0a84ff?logo=thunderbird&logoSize=auto)][tb]<br>
4-
[![Status: Beta](https://img.shields.io/badge/project_status-beta-f1b802)][rels]
5-
[![Latest release](https://img.shields.io/github/v/release/exteditor/ghostbird?include_prereleases&logo=refinedgithub&logoColor=white&logoSize=auto)][rels]<br>
3+
[![Supports Thunderbird ESR](https://img.shields.io/badge/supports-Thunderbird_140_ESR-0a84ff?logo=thunderbird&logoSize=auto)][tb]
64
[![Github Actions Status](https://github.com/exteditor/ghostbird/actions/workflows/build.yml/badge.svg)](https://github.com/exteditor/ghostbird/actions/workflows/build.yml)
5+
[![Status: Beta](https://img.shields.io/badge/project_status-beta-cce165)][rels]
6+
[![Latest release](https://img.shields.io/github/v/release/exteditor/ghostbird?include_prereleases&logo=refinedgithub&logoColor=white&logoSize=auto)][rels]
77

88
[![Download on AMO](https://raw.githubusercontent.com/thunderbird/webext-support/refs/heads/master/images/get-the-addon.svg)](#installation)
99

@@ -13,14 +13,14 @@ This repo contains an in-development Thunderbird add-on that works as a [GhostTe
1313

1414
## Requirements
1515

16-
* [Thunderbird 140][tb] (We will mainly support ESR releases)
16+
* [Thunderbird 140][tb] (We will mainly support the latest ESR)
1717
* A text editor that has a GhostText server add-on installed and running:
1818

1919
[![Sublime Text][sublimetext-svg]](https://sublime.wbond.net/packages/GhostText)
2020
[<img width="48" height="48" alt="VSCodium" title="VSCodium" src="https://raw.githubusercontent.com/VSCodium/vscodium.github.io/refs/heads/master/img/codium_cnl.svg" >](https://open-vsx.org/extension/fregante/ghost-text)
2121
[![Visual Studio Code][vscode-svg]](https://marketplace.visualstudio.com/items?itemName=fregante.ghost-text)
2222
[![GNU Emacs][emacs-svg]](https://melpa.org/#/atomic-chrome)
23-
[![Vim][vim-svg]](https://github.com/raghur/vim-ghost)
23+
[![Vim][vim-svg]][vimghost]
2424
[![Neovim][nvim-svg]](https://github.com/subnut/nvim-ghost.nvim)
2525
[<img src="https://9fans.github.io/plan9port/dist/spaceglenda100.png" width="48" height="48" alt="Acme" title="Acme">](https://github.com/fhs/Ghost)
2626
[<img src="https://github.com/user-attachments/assets/b0ca34ed-5508-458f-b7af-2642824bf7f7" width="48" height="48" alt="Helix" title="Helix">][helix]
@@ -56,7 +56,7 @@ Alternatively, you can:
5656

5757
### Build from source
5858

59-
* Basically, `make` will do, which internally calls `yarn install && yarn build`.
59+
* Basically, running `make` will do, which is roughly equivalent to `yarn install && yarn build`.
6060
* See [CONTRIBUTING.md](./CONTRIBUTING.md) to get started.
6161

6262
## Usage
@@ -69,6 +69,10 @@ Alternatively, you can:
6969
4. Write your email in the text editor.
7070
5. Close your text editor to stop Ghostbird.
7171

72+
* Example using [Vim-Ghost][vimghost]
73+
74+
[vimghost.webm](https://github.com/user-attachments/assets/150ef991-10b8-45e2-bb2c-690f1b45a7ea)
75+
7276
* Example using Notepad++ via GhostText-Any
7377

7478
<img width="600" height="302" alt="Screenshot using Notepad++ with GhostText-Any" src="https://github.com/user-attachments/assets/a4f92beb-a6f2-4a67-ae94-aa02af64539e" />
@@ -133,7 +137,10 @@ gtClient -->|Updates| mailCompose
133137

134138
### v0.2.1 (Beta) - Current
135139

136-
* :construction: [Fix empty host field being sent to the server](https://github.com/exteditor/ghostbird/issues/22)
140+
* :nest_with_eggs: [Fix empty host field being sent to the server](https://github.com/exteditor/ghostbird/issues/22)
141+
142+
### v0.3.0 (Beta) - 2025 Q4
143+
137144
* :construction: [Show notifications](https://github.com/exteditor/ghostbird/issues/24)
138145

139146
### v0.x.x (Beta) - 2025 Q4
@@ -180,14 +187,15 @@ If you like the idea, please:
180187

181188
We need help with:
182189

183-
* [Website](https://exteditor.github.io/ghostbird/) and materials (Please post [screenshots to the wiki](https://github.com/exteditor/ghostbird/wiki/Screenshots))
190+
* [Website](https://exteditor.github.io/ghostbird/) and materials (please post [screenshots to the wiki](https://github.com/exteditor/ghostbird/wiki/Screenshots))
191+
* Translations (check [`locales.toml`](./locales.toml) and let us know of any issues)
184192
* [Testing with various text editors](https://github.com/exteditor/ghostbird/wiki/TextEditorsKnownToWorkWith)
185193
* [Testing with various OSes](https://github.com/exteditor/ghostbird/wiki/OSesKnownToWorkWith)
186194
* Wiki pages for [user guides](https://github.com/exteditor/ghostbird/wiki/HowTo) and [troubleshooting](https://github.com/exteditor/ghostbird/wiki/Troubleshooting)
187-
* Developing the server counterpart so that this can be used as an External Editor replacement ([GhostText-Any](https://github.com/newsch/GhostText-Any/) or [Helix-Ghost][helix] can be a good starting point)
188-
* Creating a testing checklist for testing and debugging ([This page](https://github.com/exteditor/exteditor/wiki/Things-to-test) can be a good starting point)
189-
* Automating tests with the real Thunderbird (See [Testing](./doc/testing.md))
190-
* Organization members (I want to increase [the bus factor](https://en.wikipedia.org/wiki/Bus_factor) of [the organization](https://github.com/exteditor/))
195+
* Developing the server counterpart so that this can be used as a replacement for External Editor ([GhostText-Any](https://github.com/newsch/GhostText-Any/) or [Helix-Ghost][helix] can be a good starting point)
196+
* Creating a checklist for testing and debugging ([This page](https://github.com/exteditor/exteditor/wiki/Things-to-test) can be a good starting point)
197+
* Automating tests with the actual Thunderbird (See [Testing](./doc/testing.md))
198+
* Organization members (we want to increase [the organization](https://github.com/exteditor/)'s [bus factor](https://en.wikipedia.org/wiki/Bus_factor))
191199

192200
## FAQ
193201

@@ -260,3 +268,4 @@ Ghostbird is [dual-licensed under (MPL-2.0 OR GPL-3.0-or-later)](./LICENSE). See
260268
[bird]: https://en.wikipedia.org/wiki/Grey-headed_bushshrike
261269
[protocol]: https://github.com/fregante/GhostText/blob/refs/heads/main/PROTOCOL.md
262270
[amo]: https://addons.thunderbird.net/addon/ghostbird/
271+
[vimghost]: https://github.com/raghur/vim-ghost

biome.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
33
"files": {
44
"includes": [
55
"**/*.json",

doc/design.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ subgraph "Background Script"
3939
bg_router -->|fwd onCommand| notifier --> gtclient --> email_editor
4040
option_holder -.- gtclient
4141
gtclient --> connector
42-
websocket <--> connector
42+
websocket <-.-> connector
4343
end
4444
4545
subgraph "Compose Window Script"
@@ -51,10 +51,10 @@ subgraph "Compose Window Script"
5151
end
5252
5353
composeeditor -..->|read/write| compose_dom
54-
ghost_server <-----> websocket
54+
ghost_server <-....-> websocket
5555
thunderbird -- Open --> option
5656
thunderbird -- Load --> background
57-
connector <--> Port <--> port_handler
57+
connector <-.-> Port <-.-> port_handler
5858
```
5959

6060
### Sequence diagram
@@ -158,9 +158,11 @@ This is how user actions are handled:
158158

159159
### Quirks and limitations
160160

161-
* Because of [MV3 limitations][so], `background.js` may occasionally be suspended (all variables including WebSockets are unloaded, so it's effectively terminated). We do our best to prevent it, but ultimately it's up to Thunderbird.
161+
* Because of [MV3 limitations][so], `background.js` may occasionally be suspended (all variables including WebSockets are unloaded, so it's effectively terminated).
162+
* We do our best to prevent it, but ultimately it's up to Thunderbird.
162163
* We don't implement reconnecting the WebSocket connection when it is closed abnormally. The user has to click the Ghostbird button again to reconnect.
163-
* Connections will also closes when the user updates the add-on. It will be handled similarly to `(b)`.
164+
* Connections will also close when the user updates the add-on.
165+
* It will be handled similarly to the case `(b)`.
164166
* Initially, we don't support edits made in the compose window. We aim to support it in v2.0.0, but copying what the original GhostText add-on does might work well enough. We'll see.
165167

166168
## Tooling
@@ -170,7 +172,7 @@ This is how user actions are handled:
170172
* See [CONTRIBUTING.md](../CONTRIBUTING.md#code-style) for the code style.
171173

172174
* [Barrelsby](https://github.com/bencoveney/barrelsby) generates `index.ts`.
173-
* See [`tools/tsdown_config.ts`](../tools/tsdown_config.ts).
175+
* See [building.md](./building.md) for details on build script internals.
174176

175177
## Structure of the code<a name="structure"></a>
176178

@@ -314,7 +316,7 @@ TL;DR: `root` module contains entry point and the [Composition Root][ploeh].
314316
* If `false`, `undefined`, or the property is missing, each argument to the constructor will be an instance of the class that has the name uniquely.
315317
* A class may define `static aliases: string[] | string` to have the other name.
316318
* Name clashes will result in error at startup, except ones passed to classes with `wantArray = true`.
317-
* Use of automatic instantiation must be restricted to `root/*.ts` to make the code easier to follow.
319+
* Use of automatic instantiation must be restricted to `root/` to make the code easier to follow.
318320
* `test/startup.test.ts` contains tests to verify that all classes registered can be instantiated successfully.
319321
* See [FAQ](./faq-architectural.md) for some design decisions and justification.
320322

doc/faq.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
### Which Thunderbird versions are supported?
1616

17-
* Thunderbird 128+ (We will mainly support ESR)
17+
* Thunderbird 128+ (We will mainly support the latest ESR)
1818
* Testing with newer versions is welcomed. Please report any issues you notice in newer Thunderbird versions.
1919

2020
### What text editors are supported?
@@ -126,7 +126,7 @@
126126
### What are these `api.ts` files? They seem to only contain interfaces that aren't implemented.
127127

128128
* Implementations are in other modules, mostly in `thunderbird/*.ts`.
129-
* See [Callgraphs](./design.md#callgraph) for details.
129+
* See [Callgraphs](./design.md#callgraphs) for details.
130130
* See [Module Dependencies](./design.md#module-dependencies) for relations.
131131

132132
### Why do some classes have `static isSingleton` property?
@@ -149,7 +149,7 @@
149149
[wiki]: https://github.com/exteditor/ghostbird/wiki
150150
[issue]: https://github.com/exteditor/ghostbird/issues
151151
[discussion]: https://github.com/exteditor/ghostbird/discussions
152-
[startup]: ../src/root/startup.ts
152+
[startup]: ../src/root/startup/startup_compose.ts
153153
[protocol]: https://github.com/fregante/GhostText/blob/main/PROTOCOL.md
154154
[gt]: https://ghosttext.fregante.com/
155155
[chooseicon]: https://github.com/exteditor/ghostbird/issues/7

doc/res/typedoc.cjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"use strict";
2+
3+
let nodes = document.querySelectorAll('code.mermaid');
4+
let mermaidPromise = nodes.length ? import('https://cdn.jsdelivr.net/npm/mermaid@11.12.0/dist/mermaid.esm.min.mjs') : null;
5+
6+
mermaidPromise?.then(({ default: mermaid }) => {
7+
mermaid.run({ nodes });
8+
}).catch((error) => {
9+
console.warn('Failed to load or run Mermaid:', error);
10+
});

0 commit comments

Comments
 (0)