Skip to content

Commit 565a757

Browse files
committed
docs: consolidate (#5)
1 parent 07c3372 commit 565a757

File tree

5 files changed

+26
-28
lines changed

5 files changed

+26
-28
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ pnpm run build
4343

4444
The production bundle lands in `build/`. Package it manually or use `pnpm run zip` for a distributable archive located in `package/`.
4545

46+
## Releases
47+
48+
Release Please manages versioning and release notes. Check the autogenerated root `CHANGELOG.md` or the GitHub Releases tab for the latest history.
49+
4650
---
4751

4852
Bootstrapped with [create-chrome-ext](https://github.com/guocaoyi/create-chrome-ext)

docs/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ Additional scripts live in `package.json`, including `pnpm build` for production
2323
- [Extension Flow](./extension-flow.md)
2424
- [UI Guidelines](./ui-guidelines.md)
2525
- [Testing Guide](./testing.md)
26-
- [Changelog](./changelog.md)
26+
27+
Release notes are generated automatically via release-please and published with GitHub Releases; there is no manual changelog in this folder.
2728

2829
## Doc Conventions
2930

docs/architecture.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
CoderChart follows the typical MV3 separation: a background service worker maintains defaults, the content script renders diagrams in-page, and the options UI manages configuration. Shared utilities in `src/shared` allow all surfaces to agree on settings and URL matching.
44

5+
For a user-centric walkthrough of the lifecycle, see [`extension-flow.md`](./extension-flow.md).
6+
57
## Runtime Components
68

79
- **Background (`src/background/index.ts`)**
@@ -25,7 +27,7 @@ CoderChart follows the typical MV3 separation: a background service worker maint
2527

2628
```mermaid
2729
flowchart TD
28-
A[Load content script] --> B[getSettings()]
30+
A[Load content script] --> B[Fetch settings]
2931
B --> C{autoRender enabled?}
3032
C -- No --> D[Stay idle]
3133
C -- Yes --> E{URL matches whitelist?}
@@ -55,5 +57,6 @@ flowchart TD
5557

5658
## Known Constraints
5759

58-
- Builds occasionally report Rollup chunk-size warnings; adjust splitting before release if bundle size grows.
59-
- Rendering currently assumes Mermaid syntax; invalid diagrams surface an inline error but do not retry automatically.
60+
- Clearing all host patterns in options is not persisted: `normalizeSettings` restores the default ChatGPT domains, so disable `autoRender` to pause rendering globally.
61+
- PNG export relies on drawing the generated SVG into a canvas; diagrams that pull in external assets or exceed canvas limits can fail to export and log a warning.
62+
- Mermaid parse failures surface inline with a copyable fix prompt, but there is still no automatic retry or self-healing.

docs/changelog.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/extension-flow.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Extension Flow
22

3-
This guide walks through the end-to-end experience from installation to exporting rendered diagrams.
3+
This guide outlines the user-visible lifecycle. For component responsibilities and deeper mechanics, see [`architecture.md`](./architecture.md).
44

5-
## Narrative Flow
5+
## Lifecycle Overview
66

7-
1. **Install:** User loads the unpacked build or installs from the Chrome Web Store. The background script seeds default settings in `chrome.storage.sync`.
8-
2. **Grant permissions:** Chrome applies host permissions declared in `manifest.ts` (ChatGPT domains and localhost during development).
9-
3. **Open supported page:** When the user opens chatgpt.com or another whitelisted host, the content script loads, retrieves settings, and checks the URL against the whitelist.
10-
4. **Render diagrams:** Matching Mermaid code fences trigger the inline renderer. Mermaid initialises with theme selection, generates SVG, and injects a container with toolbar controls.
11-
5. **Adjust settings:** Users can visit `options.html` to disable auto-rendering, edit host patterns, or reset to defaults. Changes sync across devices.
12-
6. **Use toolbar:** Inline buttons allow collapsing/expanding the diagram, scrolling back to the source code block, and exporting as SVG or PNG.
13-
7. **Download pipeline:** SVG downloads reuse the cached render, while PNG downloads convert the SVG via an off-screen canvas before prompting a file save.
14-
8. **Keep updated:** A MutationObserver re-runs rendering when the chat adds new content, and storage listeners reconfigure the script when settings change.
7+
| Step | Trigger | Primary owner | Notes |
8+
| --- | --- | --- | --- |
9+
| Install or upgrade | Extension installed from source or Web Store | Background service worker | Seeds defaults and handles migrations (`architecture.md` → Runtime Components). |
10+
| Host access granted | Chrome applies `manifest.ts` host permissions | Chrome / MV3 platform | Controls where the content script can run (`architecture.md` → Runtime Components). |
11+
| Page activation | User opens a whitelisted URL | Content script | Fetches settings, checks URL against patterns, and, if allowed, initialises Mermaid (`architecture.md` → Data Flow Sequence). |
12+
| Inline rendering | Mermaid blocks detected | Content script + Mermaid runtime | Injects managed containers, themes Mermaid, and caches SVG output (`architecture.md` → Mermaid Rendering & Downloads). |
13+
| Settings changes | Options UI edits or resets settings | Options UI + shared settings utils | Saves updates through `saveSettings`; listeners reconcile state across surfaces (`architecture.md` → Settings Synchronisation). |
14+
| Continuous updates | Chat adds new content or settings sync changes arrive | Content script | MutationObserver re-runs detection; storage listeners reapply activation rules (`architecture.md` → Settings Synchronisation). |
1515

1616
## Sequence Diagram
1717

@@ -21,7 +21,8 @@ sequenceDiagram
2121
participant C as Chrome
2222
participant B as Background
2323
participant CS as Content Script
24-
participant Opt as Options UI
24+
participant Options as Options UI
25+
participant Toolbar as Download Toolbar
2526
2627
U->>C: Install extension
2728
C->>B: fire onInstalled
@@ -40,8 +41,8 @@ sequenceDiagram
4041
U->>Toolbar: Click download SVG/PNG
4142
Toolbar->>CS: fetch cached SVG / convert to PNG
4243
CS->>U: Trigger file download
43-
U->>Opt: Open options page
44-
Opt->>chrome.storage.sync: save updated settings
44+
U->>Options: Open options page
45+
Options->>chrome.storage.sync: save updated settings
4546
chrome.storage.sync-->>CS: onChanged event
4647
CS->>CS: Apply settings (activate/deactivate/re-render)
4748
```

0 commit comments

Comments
 (0)