PasteMD README

The project's README from github.com/RICHQAQ/PasteMD. As one markdown file: README.md.

PasteMD

PasteMD

Release Downloads License AtomGitStars Python 3.12+ Platform

English | 简体中文 | 日本語

Featured|HelloGitHub RICHQAQ%2FPasteMD | Trendshift

❤️ 赞助商

Atlas Cloud Atlas Cloud 是一个全模态 AI 推理平台,为开发者提供单一 AI API,用于访问视频生成、图像生成和 LLM API。无需管理多个供应商集成,接入一次即可统一访问覆盖所有模态的 300+ 精选模型。
查看 Atlas Cloud 新的 Coding Plan 推广,获得更具预算友好性的 API 访问:https://www.atlascloud.ai/console/coding-plan
APIMart 感谢 APIMart 赞助了本项目!APIMart 是专注 AI 图片/视频生成的低价 API 平台,GPT-Image-2 低至 $0.006/张,1 美元可出图 160+ 张。图片、视频一套异步 API 通吃,提交任务拿 ID、回调取结果,跑批万张不超时、换模型不改代码。按量付费、无月费,通过此注册链接注册即可开用。

🌸 社团

微光漫摄 🌟感谢大家的支持!我们是一个来自南昌大学软件学院的学生技术兴趣社团,热爱开源,热爱二次元,热爱生活。❤️ 南昌大学微光漫摄是一个以 ACGN 为坐标的二次元社团。我们因动画、漫画、游戏与影像相聚,在这里分享热爱、交流创作,也把喜欢的事变成作品。
欢迎访问微光漫摄官网,认识更多同频的伙伴。

在写论文或报告时,从 ChatGPT / DeepSeek 等 AI 网站中复制出来的公式在 Word 里总是乱码?Markdown 表格复制到 Excel 总是不行?PasteMD 就是为了解决这个问题而生的,嘿嘿

我可是高性能的

一个常驻托盘的小工具: 从 剪贴板读取 Markdown,调用 Pandoc 转换为 DOCX,并自动插入到 Word/WPS 光标位置。

✨ 功能:智能识别 Markdown 表格,一键粘贴到 Excel!

✨ 功能:智能识别 HTML富文本,方便直接复制网页上的ai回复,一键粘贴到 Word/WPS!

✨ 新功能:应用扩展(HTML+Markdown/HTML/Markdown/LaTeX/文件粘贴),可按应用/窗口标题匹配(如语雀/QQ等)。

✨ 新功能:转换增强:支持按转换类型配置 Pandoc Filters;自动修复部分 LaTeX 语法与单 $...$ 公式块。


功能特点

演示效果

Markdown → Word/WPS

演示动图

复制网页中的ai回复 → Word/WPS

演示HTML动图

Markdown 表格 → Excel

演示Excel动图

设置格式

演示设置格式动图


📊 AI 网站兼容性测试

以下是主流 AI 对话网站的复制粘贴兼容性测试结果:

AI 网站 复制 Markdown
(无公式)
复制 Markdown
(含公式)
复制网页内容
(无公式)
复制网页内容
(含公式)
Kimi ✅ 完美支持 ✅ 完美支持 ✅ 完美支持 ⚠️ 无法显示公式
DeepSeek ✅ 完美支持 ✅ 完美支持 ✅ 完美支持 ✅ 完美支持
通义千问 ✅ 完美支持 ✅ 完美支持 ✅ 完美支持 ⚠️ 无法显示公式
豆包* ✅ 完美支持 ✅ 完美支持 ✅ 完美支持 ✅ 完美支持
智谱清言
/ChatGLM
✅ 完美支持 ✅ 完美支持 ✅ 完美支持 ✅ 完美支持
ChatGPT ✅ 完美支持 ⚠️ 公式显示为代码 ✅ 完美支持 ✅ 完美支持
Gemini ✅ 完美支持 ✅ 完美支持 ✅ 完美支持 ✅ 完美支持
Grok ✅ 完美支持 ✅ 完美支持 ✅ 完美支持 ✅ 完美支持
Claude ✅ 完美支持 ✅ 完美支持 ✅ 完美支持 ✅ 完美支持

图例说明:

测试说明:

  1. 复制 Markdown:点击 AI 回复中的"复制"按钮(通常复制的是 Markdown 格式,但是部分网站也会携带上html)
  2. 复制网页内容:直接选中 AI 回复内容进行复制(复制的是 HTML 富文本)

🚀使用方法

  1. 下载可执行文件(Releases 页面):

    • PasteMD_vx.x.x.exe:便携版,需要你本机已经安装好 Pandoc 并能在命令行运行。 若未安装,请到 Pandoc 官网 下载安装即可。 (不再提供,需要请自行编译)
    • PasteMD_pandoc-Setup.exe:一体化安装包,自带 Pandoc,不需要另外配置环境。
  2. 打开 Word、WPS 或 Excel,光标放在需要插入的位置。

  3. 复制 Markdown 或者 网页内容 到剪贴板,按下热键 Ctrl+Shift+B。

  4. 转换结果会自动插入到文档中:

    • Markdown 表格 → 自动粘贴到 Excel(如果 Excel 已打开)
    • 普通 Markdown/网页内容 → 转换为 DOCX 并插入 Word/WPS
  5. 右下角会提示成功/失败。


⚙️配置

首次运行会在用户数据目录生成 config.json(Windows:%APPDATA%\\PasteMD\\config.json, MacOS: ~/Library/Application Support/PasteMD/config.json),可手动编辑:

{
  "hotkey": "<ctrl>+<shift>+b",
  "pandoc_path": "pandoc",
  "reference_docx": null,
  "save_dir": "%USERPROFILE%\\Documents\\pastemd",
  "keep_file": false,
  "notify": true,
  "startup_notify": true,
  "enable_excel": true,
  "excel_keep_format": true,
  "paste_delay_s": 0.3,
  "no_app_action": "open",
  "md_disable_first_para_indent": true,
  "html_disable_first_para_indent": true,
  "html_formatting": {
    "strikethrough_to_del": true
  },
  "move_cursor_to_end": true,
  "Keep_original_formula": false,
  "enable_latex_replacements": true,
  "fix_single_dollar_block": true,
  "language": "zh-CN",
  "pandoc_request_headers": [
    "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
  ],
  "pandoc_filters": [],
  "pandoc_filters_by_conversion": {
    "md_to_docx": [],
    "html_to_docx": [],
    "html_to_md": [],
    "md_to_html": [],
    "md_to_rtf": [],
    "md_to_latex": []
  },
  "extensible_workflows": {
    "html": {
      "enabled": true,
      "apps": [],
      "keep_formula_latex": true
    },
    "md": {
      "enabled": true,
      "apps": [],
      "html_formatting": {
        "css_font_to_semantic": true,
        "bold_first_row_to_header": true
      }
    },
    "latex": {
      "enabled": true,
      "apps": []
    },
    "file": {
      "enabled": true,
      "apps": []
    }
  }
}

字段说明:

修改后可在托盘菜单选择 “重载配置/热键” 立即生效。


🔧 高级功能:自定义 Pandoc Filters

什么是 Pandoc Filter?

Pandoc Filter 是在文档转换过程中对内容进行自定义处理的插件程序。PasteMD 支持配置多个 Filter,按顺序依次处理文档内容,实现扩展功能。

使用场景示例:Mermaid 图表支持

如果您想在 Markdown 中使用 Mermaid 图表并正确转换到 Word,可以使用 mermaid-filter。

1. 安装 mermaid-filter

npm install --global mermaid-filter

前置条件:需要先安装 Node.js

⚠️ 故障排除:Chrome 下载失败

安装 mermaid-filter 时需要下载 Chromium 浏览器。如果自动下载失败,可以手动下载:

步骤 1:查找所需的 Chromium 版本号

查看文件:%APPDATA%\npm\node_modules\mermaid-filter\node_modules\puppeteer-core\lib\cjs\puppeteer\revisions.d.ts

找到类似以下内容:

chromium: "1108766";

或在报错信息里,如:

npm error Error: Download failed: server returned code 502. URL: https://npmmirror.com/mirrors/chromium-browser-snapshots/Win_x64/1108766/chrome-win.zip

找到类似 Win_x64/1108766 的版本号。

记下这个版本号(例如:1108766)。

步骤 2:下载 Chromium

根据上一步获取的版本号,下载对应的 Chromium:

https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/1108766/chrome-win.zip

(将 URL 中的 1108766 替换为你查到的版本号)

步骤 3:解压到指定目录

将下载的 chrome-win.zip 解压到以下目录:

%USERPROFILE%\.cache\puppeteer\chrome\win64-1108766\chrome-win

(目录中的 1108766 也需要替换为你的版本号)

解压后,应该有 chrome.exe 位于:
%USERPROFILE%\.cache\puppeteer\chrome\win64-1108766\chrome-win\chrome.exe

2. 配置到 PasteMD

方式一:通过设置界面

方式二:编辑配置文件

{
  "pandoc_filters": [
    "%APPDATA%\\npm\\mermaid-filter.cmd"
  ]
}

3. 测试效果

复制以下 Markdown 内容并使用 PasteMD 转换:

```mermaid
graph LR
    A[开始] --> B[处理]
    B --> C[结束]
```

Mermaid 图表将被渲染为图片并插入到 Word 文档中。

更多 Filter 资源


🧩 应用扩展(自定义粘贴工作流)

设置 → 应用扩展 中可以为不同应用配置粘贴模式,支持按窗口标题正则匹配:

提示:同一个应用只建议配置一种工作流(避免冲突);需要区分窗口标题时可使用“窗口名称匹配”。

示例配置(节选):

Windows 下 id 通常为应用的 exe 路径;macOS 为应用的 bundle id(建议通过设置界面添加,自动填充)。

{
  "extensible_workflows": {
    "html": {
      "enabled": true,
      "apps": [
        {
          "name": "语雀",
          "id": "/path/语雀.exe",
          "window_patterns": []
        }
      ],
      "keep_formula_latex": true
    },
    "latex": {
      "enabled": true,
      "apps": [
        {
          "name": "chrome",
          "id": "/path/chrome.exe",
          "window_patterns": [
            ".*overleaf.*"
          ]
        }
      ]
    },
    "file": {
      "enabled": true,
      "apps": [
        {
          "name": "QQ",
          "id": "/path/qq.exe",
          "window_patterns": []
        }
      ]
    }
  }
}

托盘菜单


📦从源码运行 / 打包

建议 Python 3.12 (64位)。

pip install -r requirements.txt
python main.py

使用 PyInstaller:

pyinstaller --clean -F -w -n PasteMD
  --icon assets\icons\logo.ico
  --add-data "assets\icons;assets\icons"
  --add-data "pastemd\i18n\locales\*.json;pastemd\i18n\locales"
  --add-data "pastemd\lua;pastemd\lua"
  --hidden-import plyer.platforms.win.notification
  main.py

生成的程序在 dist/PasteMD.exe。


⭐ Star

感谢每一位 Star 的帮助,欢迎分享给更多小伙伴~,想要达成4096 star🌟,我会努力的喵

喜欢你

Star History Chart

🍵支持与打赏

如果有什么想法和好建议,欢迎issue交流!🤯🤯🤯

也欢迎加入 PasteMD使用交流群 与其他用户交流:

PasteMD交流群二维码
扫码加入PasteMD QQ交流群

希望这个小工具对你有帮助,欢迎请

PasteMD (RICHQAQ/PasteMD)

clipboard
Searching Database…

5.4K ·GitHub
What is this?PasteMD is a system-tray utility that lets you copy Markdown or an AI chat response (ChatGPT, DeepSeek, Claude, etc.) and paste it perfectly formatted into Word, WPS, or Excel with one hotkey, converting the content via Pandoc.
Is this a Word add-in or a standalone background app?It is a standalone desktop app that sits in the system tray; it is not a Word/WPS plugin. It reads the clipboard, converts it with Pandoc, and inserts the result at the cursor position in whichever app is in front.
How do I start using it?Download the all-in-one installer (pandoc-Setup.exe) from the Releases page, open Word/WPS/Excel and place the cursor where you want content, then copy Markdown or a web AI reply and press Ctrl+Shift+B to paste the converted result.
Do I need Pandoc installed separately?No if you use the bundled installer, since pandoc-Setup.exe ships with Pandoc already included; the old portable exe required you to install Pandoc yourself, but that build is no longer provided.
Does math formula pasting always work?No, it depends on the AI site: some sites like Kimi and 通义千问 lose formulas when you copy the web reply, and ChatGPT shows formulas as raw LaTeX code instead of rendered equations, requiring manual fixing in Word.
Does it run on both Windows and macOS?Yes, the config file location is documented for both: %APPDATA%\PasteMD\config.json on Windows and ~/Library/Application Support/PasteMD/config.json on macOS.
What happens if Word, WPS, or Excel isn't already open when I paste?A configurable 'noAppAction' setting decides the fallback: open the app automatically, just save the DOCX, copy it to the clipboard as a file, or do nothing, with 'open' as the default.
Can I customize how content gets converted, e.g. for Mermaid diagrams?Yes, you can chain custom Pandoc Filters (Lua scripts or executables) per conversion type; the README walks through adding mermaid-filter so Mermaid diagrams render as images inside the pasted Word document.
Can different apps get different paste behaviors?Yes, the 'Application Extensions' settings let you match an app by its executable path or window title (regex) and choose a paste mode per app, such as Markdown for note apps, LaTeX for Overleaf, or file-attachment mode for QQ/WeChat.
What languages does the interface support?The UI language is configurable between Simplified Chinese (zh-CN), English (en-US), and Japanese (ja-JP).
Creator
RICHQAQ
Size
32.1 MB
Stars
5.4K
Age
11mo
Commits · 90 Days