wewrite-publish
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesewewrite-publish — 排版、预览、草稿箱
wewrite-publish — Typesetting, Preview, and Draft Box
前置
Prerequisites
用户指定文章时使用该文件;否则 。如果
存在且非空就使用它,否则使用 ;读取标题、
摘要、封面、预览路径、发布权限和降级标记。已完成文章可以直接排版或发布,不要恢复写作
任务。主题取 style.yaml 的 ,默认 。
wewrite run showartifacts.illustrated_articleartifacts.articlethemeprofessional-clean排版和发布不得自动调用 。没有封面时照常生成本地预览;只有用户另行要求
配图时才进入视觉模块。
wewrite-visual用户本轮明确要求“推到草稿箱/发布”时,有任务先运行
;用户撤回时运行 。
只排版、预览或“完整制作”都不能授予发布权限。
wewrite run permission publish allowwewrite run permission publish deny有任务时进入:
bash
wewrite run step publish in_progressUse this file when the user specifies an article; otherwise use . If exists and is not empty, use it; otherwise use . Read the title, abstract, cover image, preview path, publishing permission, and downgrade flag. Completed articles can be directly typeset or published — do not resume writing tasks. The theme is taken from the field in , defaulting to .
wewrite run showartifacts.illustrated_articleartifacts.articlethemestyle.yamlprofessional-cleanTypesetting and publishing must not automatically invoke . Generate local previews normally even without a cover image; only enter the visual module when the user additionally requests article images.
wewrite-visualWhen the user explicitly requests "push to draft box/publish" in the current round, first run if there is an active task; when the user revokes the request, run . Mere typesetting, preview, or "full production" does not grant publishing permission.
wewrite run permission publish allowwewrite run permission publish denyIf there is an active task, proceed with:
bash
wewrite run step publish in_progress预检
Pre-checks
- 标题存在且符合微信限制;摘要不超过 120 字节;正文 200-20000 字。
- 正文图片不超过 10 张且实际可读;表格不超过 4 列。
- 发布草稿必须有封面。没有封面不能假设微信会补默认图,改走本地预览。
- 发布必须同时满足:、
permissions.publish=true、用户本轮没有撤回。flags.skip_publish=false
- The title exists and complies with WeChat's restrictions; the abstract must not exceed 120 bytes; the main text must be between 200 and 20,000 characters.
- The main text contains no more than 10 images, all of which are readable; tables must have no more than 4 columns.
- A cover image is required for publishing drafts. If there is no cover image, do not assume WeChat will provide a default image — switch to local preview instead.
- Publishing must simultaneously satisfy all of the following: ,
permissions.publish=true, and the user has not revoked the request in the current round.flags.skip_publish=false
动作
Actions
始终先生成本地预览,有任务时保存到 ;任务外文章保存到原文件旁:
artifacts.previewbash
wewrite preview {article} --theme {theme} --no-open -o {preview}确认预览产物存在且通过兼容性校验。若没有明确发布权限,流程到此结束;“写一篇”“完整制作”
都不等于允许发布。
只有用户明确要求草稿箱且预检全部通过时执行:
bash
wewrite publish {article} --cover {cover} --theme {theme} --title "{title}" --digest "{digest}"发布失败时保留预览,不自动重试产生外部动作。有任务时更新 ;成功时再写
,随后:
publish.preview_htmlpublish.media_idbash
wewrite run step publish completedAlways generate a local preview first. If there is an active task, save the preview to ; for articles outside a task, save it next to the original file:
artifacts.previewbash
wewrite preview {article} --theme {theme} --no-open -o {preview}Confirm that the preview artifact exists and passes the compatibility check. If there is no explicit publishing permission, the process ends here. Requests like "write an article" or "full production" do not constitute permission to publish.
Execute the following only when the user explicitly requests pushing to the draft box and all pre-checks pass:
bash
wewrite publish {article} --cover {cover} --theme {theme} --title "{title}" --digest "{digest}"If publishing fails, keep the preview and do not automatically retry with external actions. If there is an active task, update ; upon successful publishing, write , then run:
publish.preview_htmlpublish.media_idbash
wewrite run step publish completed辅助功能
Auxiliary Features
| 用户说 | 动作 |
|---|---|
| 看主题 | |
| 换主题 | 重新 preview;只有再次明确要求才重新 publish |
| 做图片帖 | 先确认用户确实要推草稿箱,再执行 |
| 只排版 | 只 preview |
| User Request | Action |
|---|---|
| View themes | |
| Change theme | Re-run preview; only re-publish if explicitly requested again |
| Create image post | First confirm the user definitely wants to push to the draft box, then execute |
| Only typeset | Only run preview |