md-to-feishu

Convert local Markdown files to Feishu (Lark) documents with automatic image uploading. Uses the feishu-docx CLI tool.

By zc277584121 · 3,463 installs

npx skills add zc277584121/marketing-skills --skill md-to-feishu

Source repository · Upstream listing

Markdown to Feishu Document Convert a local Markdown file into a Feishu document, with automatic image upload. User Input The user only needs to provide a Markdown file path . Title is optional — if not provided, extract it automatically (see below). Step 1: Determine the Document Title 1. Read the Markdown file and look for the first heading — use that as the title. 2. If no heading exists, scan the content and generate a concise, descriptive title based on the topic. 3. If the user explicitly provides a title, use that instead. Step 2: Check the Runtime Environment Try each option in order. Use the first one that works . Option A: uvx (preferred) If uvx is available, the run command is: If uvx runs with Python < 3.11, add python 3.11 : Option B: feishu docx already installed If found, check Python version: If Python = 3.11, the run command is: Option C: Nothing available — install guidance If neither uvx nor feishu docx is found, tell the user: feishu docx requires Python = 3.11. Install with one of: Feishu credentials must be configured first: Then stop and wait for the user to set up the environment. Step 3: Pre process Mermaid Blocks The feishu docx tool cannot handle Mermaid code blocks. Before uploading, check if the Markdown contains any mermaid fenced code blocks. If none are found, skip to Step 4 . 3b: Create a temporary copy Copy the original Markdown file to a temp file in the same directory (so relative image paths still work): For example: blog post.md → blog post.feishu tmp.md All subsequent modifications happen on this temp copy. The original file is never modified. 3c: Render Mermaid diagrams to PNG For each block in the temp file, render it to a PNG image using the mermaid.ink API: Important: The User Agent header is required — mermaid.ink returns 403 without it. Save rendered images to the same directory as the Markdown file, using descriptive filenames based on diagram content: GOOD: mermaid architecture overview.png , mermaid data flow.png BAD: mermaid 1.png , diagram.png 3d: Replace Mermaid blocks with image references In the temp copy, replace each block with a Markdown image reference: Use relative paths from the temp file to the rendered images. 3e: Use the temp file for upload From this point, the temp file becomes the <MARKDOWN FILE PATH used in Step 4. Step 4: Run the Command Run from the directory where the Markdown file lives (or where its relative image paths resolve correctly), so that local image references work. The tool will: Convert Markdown blocks to Feishu format Automatically upload local images referenced in the Markdown Wait ~10s for block consistency before uploading images Step 5: Clean Up If a temp file was created in Step 3: Delete the temp Markdown file ( .feishu tmp.md ) Delete all rendered Mermaid PNG files created in Step 3c (they were only needed for the upload) Step 6: Report Result Show the user: Number of blocks converted and images uploaded The created document ID Success or failure status If it fails with authentication errors, remind the user to configure credentials: