feat: CLI support type:image for newspic publishing#32
Conversation
|
这个功能是什么意思啊? |
|
感谢 review!这个 PR 补全了小绿书(贴图)发布在 CLI 端的缺失环节。 之前 serve 端已经支持了 这个 PR 的改动:
改动很小(核心逻辑在 |
|
补充一下设计思路: 为什么用 微信公众号后台本身就把内容分为「文章」「贴图」「视频」「音频」四种类型, 为什么自动从正文提取图片,而不是让用户手动填写 图片已经写在正文里了( 流程:
这样用户侧的改动最小——加一个字段,图片照常写在正文里就行。 |
|
目前可以通过 你可能是想把正常写的图文也能当小绿书发布,这样就有必要添加 |
|
对,你说得没错。core 本身已经通过 我加 用户在 Obsidian 里写了一篇带图片的笔记,正文里自然地写了
第二种方式对用户更友好,不用重复填写图片路径。 |
|
根据我们在 caol64/wenyan-core#17 的讨论,已将 core 合并后,CLI 无需任何代码改动—— 本 PR 可以关闭。 |
7d6f0db to
4a4ce8d
Compare
Summary
wenyan publishnow detectstype: imagein frontmatter, automatically extracts image references from the body, injectsimage_list, and routes to the newspic (小绿书) publishing pathtransformImageTypeContentutility to handle thetype: image→image_listtransformation@wenyan-md/coreto 3.0.6 which providespublishImageTextToWechatDraftChanges
src/utils.ts: AddedtransformImageTypeContent()— parses frontmatter fortype: image, extractsand![[path]]images from body, injectsimage_listinto frontmatter, removes image references from body textsrc/cli.ts: WrappedgetInputContentto apply the transform before passing to core's rendering pipeline. Works for both server mode (--server) and local modepackage.json: Upgraded@wenyan-md/corefrom ^3.0.5 to ^3.0.6How it works
No changes needed to core module — it already handles
image_listnatively.Test plan
pnpm build)type: imagearticle published successfully to WeChat draft via server modetype: image) still publishes correctlytransformImageTypeContent(existing test infra has module resolution issues on Windows/pnpm)