update at 2025-09-22 18:54:59

This commit is contained in:
douboer
2025-09-22 18:54:59 +08:00
parent 81c6f52b69
commit 3d2171e837
9 changed files with 493 additions and 72 deletions

View File

@@ -19,6 +19,8 @@ classDiagram
+postArticle(appid,cover?)
+postImages(appid)
+exportHTML()
+transformGalleryBlock()
+applyCustomInlineBlocks()
}
class LocalImageManager {
+setImage(path,info)
@@ -38,6 +40,9 @@ classDiagram
+wxInfo
+authKey
+enableMarkdownImageToWikilink
+galleryPrePath
+galleryNumPic
+defaultCoverPic
}
class WeChatAPI {
+wxGetToken()
@@ -100,20 +105,38 @@ graph TD
```mermaid
graph TD
A[Need Cover?] -->|No| Z[Skip]
A -->|Yes| B[Strip Frontmatter]
B --> C[Scan Markdown Images]
B --> D[Scan Wikilink Images]
C --> E[Merge Candidates]
D --> E[Merge Candidates]
E --> F{Any Candidate?}
F -- No --> Z[Cover stays empty]
F -- Yes --> G[Sort by index]
G --> H[Select first -> cover wikilink]
A -->|Yes| B[Frontmatter cover?]
B -- Yes --> H[Use frontmatter]
B -- No --> C[Strip Frontmatter]
C --> D[Scan Markdown Images]
C --> E[Scan Wikilink Images]
D --> F[Collect Candidates]
E --> F[Collect Candidates]
F --> G{Any Body Image?}
G -- Yes --> H[Use first body image]
G -- No --> I[Gallery Expanded?]
I -- Yes --> H[Use first gallery image]
I -- No --> J[defaultCoverPic Config?]
J -- Yes --> H[Use defaultCoverPic]
J -- No --> Z[Cover stays empty]
```
## 4.1 行级轻语法与日志节流 (补充)
```mermaid
graph TD
M[Markdown Raw] --> P[Preprocess Gallery Shortcode]
P --> GB[Gallery Block Parse]
GB --> MD[Marked Parse]
MD --> IB[applyCustomInlineBlocks]
IB --> R[Render HTML]
R --> L{Log Throttle}
L --> R1[Path Log]
L --> R2[Cover Fallback Log]
```
## 5. 未来 RenderService Pipeline 图
```mermaid
graph LR
graph TD
L[Loader] --> FM[Frontmatter]
FM --> PP[Preprocessors]
PP --> P[Parser]
@@ -127,14 +150,14 @@ graph LR
## 6. 并发上传示意 (未来优化)
```mermaid
graph TD
A[images[]] --> B[Partition into tasks]
B --> C[Promise Pool (N=4)]
C --> D[Upload Task]
A[Images] --> B[Partition]
B --> C[Pool]
C --> D[Upload]
D --> E{Success?}
E -- No --> R[Retry with backoff]
E -- Yes --> F[Collect media_id]
E -->|No| R[Retry]
E -->|Yes| F[Collect ids]
R --> C
F --> G[All Done]
F --> G[Done]
```
## 7. 状态机概览 (发布按钮)