obsidian-to-weixin
Obsidian to Weixin
Config (Optional)
Set a default author in ~/.agents/config.yaml:
obsidian_to_weixin:
author: "Alice Wang"
You can also set a global default:
author: "Alice Wang"
Workflow (Sequential)
- Resolve vault path and note path/title using
obsidian-cli. - Read note file as Markdown (no Notion export/conversion).
- Ensure
authorexists in front matter (and add visible byline if needed). - Upload note images to Weixin (
material image) and replace Markdown image URLs. - Prepare
thumb_media_id:- Use the first image in note order as Weixin cover (
material thumb). - If note has no image, fallback to the latest Weixin image material ID.
- Use the first image in note order as Weixin cover (
- Generate
digestwith AI summarization (if user did not provide one). - Create Weixin draft from Markdown stdin via
node-wxcli draft add --format markdown --css-path ....
Inputs (Ask if missing)
note_path: Obsidian note path from vault root (recommended), e.g.Projects/Weekly Update.md.note_title: title/name to search whennote_pathis missing.author: optional, fallback from~/.agents/config.yaml.css_path: required when using--format markdown; if missing, default toassets/default.css.thumb_media_id: only needed if first-image + fallback both fail.digest: optional user-provided summary; if missing, generate via AI from the final Markdown.
Prerequisites
obsidian-cliinstalled and default vault configured.node-wxcliinstalled and authenticated.curl+jqavailable.
Step 1: Resolve note from Obsidian
Get default vault path:
vault_path=$(obsidian-cli print-default --path-only)
If note_path is provided, use it directly.
If only note_title is provided, search candidates and confirm exact note:
obsidian-cli search "<note_title>"
obsidian-cli search-content "<note_title>"
Then resolve final path (from search result / user confirmation), and read file:
cat "$vault_path/<note_path>" > <workdir>/note.md
Step 2: Keep Markdown as source
Obsidian notes are already Markdown. Do not run any Notion export or Notion-to-Markdown conversion.
Step 3: Author handling
- If
authoris missing, read from~/.agents/config.yaml. - Ensure front matter contains
authorif your workflow requires it.
Step 4: Process images and replace URLs
Supported image references:
- Markdown image:
 - Obsidian embed:
![[image.png]]
Process in note order:
- Parse image references from
<workdir>/note.md. - Resolve each image file:
- local relative paths -> absolute file path (based on note dir/vault)
- remote URL -> download to temp file
- Upload to Weixin image material:
node-wxcli material upload --type image --file <image-file> --json | jq -r '.url'
- Replace original image target with returned Weixin URL.
- Rewrite
![[...]]to standard markdown image form:

Step 5: Prepare thumb_media_id
5.1 Primary: first image in note as cover
Take the first image reference (top-to-bottom), resolve file/download if needed, then upload as thumb:
thumb_media_id=$(node-wxcli material upload --type thumb --file <first-image-file> --json | jq -r '.media_id')
5.2 Fallback: latest Weixin image material
If note has no image:
image_count=$(node-wxcli material count --json | jq -r '.image_count')
offset=$((image_count - 1))
thumb_media_id=$(node-wxcli material list --type image --offset "$offset" --count 1 --json | jq -r '.item[0].media_id')
If no image materials exist, ask user to provide/upload cover and pass --thumb-media-id.
Step 6: Build digest with AI summarization
If digest is not provided, summarize the final Markdown content with AI and generate a concise Chinese digest:
- 1-2 sentences
- Prefer 60-120 Chinese characters
- Plain text only (no Markdown / emoji / line breaks)
- Focus on the article purpose and key outcomes
Step 7: Create draft from Markdown stdin
When using Markdown format, always pass --css-path. If css_path is missing, set:
css_path=${css_path:-assets/default.css}
node-wxcli draft add \
--title "<note_title_or_custom_title>" \
--author "<author>" \
--digest "<digest>" \
--format markdown \
--content - \
--css-path <css_path> \
--need-open-comment=1 \
--only-fans-can-comment=0 \
--thumb-media-id "$thumb_media_id" < <workdir>/note.md
Resources
references/cli-commands.md: canonical command snippets (obsidian-cli+node-wxcli).assets/default.css: default CSS for--format markdown(--css-path).
Notes
- Prefer
note_pathovernote_title. - Only use manual
--thumb-media-idwhen first-image and fallback both fail.
More from inforix/skills
notion-to-weixin
Fetch a Notion page by title, export to Markdown, convert Markdown to HTML with a user-provided CSS file, and create a Weixin draft via node-wxcli. Use when asked to publish Notion content into Weixin draftbox, or when moving Notion pages into Weixin draft as HTML.
26shmtu-word-formatter
把文章按“上海海事大学党政公文格式”刷成 Word(.docx),或对已有 .docx 进行统一排版后保存。凡是用户提到“刷格式”“按公文格式排版”“生成 Word”“把这篇文章整理成正式公文格式”“这个 docx 帮我统一格式”时都应触发本技能。
4imagegen
Generate images with Azure OpenAI GPT-image models, especially gpt-image-2 on Azure AI Foundry. Use this skill when the user asks to generate, create, render, or save an image from a text prompt using imagegen, GPT-image, gpt-image-2, Azure OpenAI image generation, or the configured Azure AI Foundry endpoint.
1electronic-trusted-certificate
Use this skill whenever the user mentions 电子可信证明,成绩单,在读证明,绩点证明 electronic trusted certificates, student proof documents, enrollment or study-status certificates, transcript or degree verification, verification codes, or asks to use the SHMTU MCP server over HTTP. This skill probes the endpoint, initializes the MCP session, lists tools, and calls the right tool with bearer-token authentication without writing secrets into repo files.
1