跳到正文
DEV Community· ABDULLAH BIN MUGHIRA·· 3 小時前AI 評分48

Docraft:在瀏覽器本機將貼上的 AI 回覆轉成 Word、PDF 和 HTML 文件

Docraft: Turn Pasted AI Responses into Word, PDF and HTML Files, Locally in Your Browser

AI 導讀

Docraft 是一款 Chrome 擴充功能,可在瀏覽器本機把貼上的 AI 回覆匯出為可編輯 Word 文件、PDF 或獨立 HTML 頁面。它支援 Markdown 格式解析、文件編輯與預覽,並可批次匯出多份回覆。不連接伺服器、帳戶、分析服務或 AI API;只要求儲存權限,讀取剪貼簿則屬可選。

正文

Cover image for Docraft: Turn Pasted AI Responses into Word, PDF and HTML Files, Locally in Your Browser

ABDULLAH BIN MUGHIRA

AI chats are great at producing structured text, but getting that text into a clean, shareable document is still a chore. Docraft is a Chrome extension that turns a pasted AI response into an editable Word file, a styled PDF, or a standalone HTML page in a couple of clicks.

Everything runs locally in your browser. There's no server, no account, no analytics, and no AI API behind it.

GitHub: https://github.com/abmdevx/docraft

What it does

Paste your text into the popup, optionally set a title, and export. When you need more control, open the full workspace.

  • Compact popup for fast paste-and-export
  • Full workspace with an editor, a live document preview, and document settings
  • Three export formats: Word (.docx), PDF, and HTML
  • Markdown-aware parsing that detects headings, paragraphs, lists, tables, code blocks, quotes, links, and inline formatting
  • Light and dark documents: a white page, or a near-black page with white text, for Word and PDF output
  • Document controls: font, size, page size, orientation, margins, title, and page numbers
  • Optional table of contents in all three formats
  • Multi-paste ZIP batches: add several responses, choose a format for each, and download them together
  • Math in PDFs: KaTeX renders supported LaTeX formulas as crisp images

Docraft compact popup

Docraft full workspace with editor, preview and settings

Privacy by design

People paste a lot of sensitive text into AI tools, so the extension asks for as little as possible:

  • Only the storage permission is required
  • clipboardRead is optional and requested only when you use the Paste action
  • No host permissions at all
  • Pasted content isn't saved unless you enable "Remember my draft"
  • Pasted HTML is treated as literal text and is never rendered with innerHTML
  • Only validated http, https, mailto, and tel links become active

Tech stack

  • React + TypeScript for the popup and workspace UIs
  • Tailwind CSS for styling and Vite for building
  • Chrome Manifest V3
  • A Markdown parser feeding separate Word, PDF, and HTML exporters
  • Automated tests for the parser, the exporters, and the UI
  • The open-source Carlito font embedded so PDFs match Calibri's metrics

Known limitations

  • PDF fonts cover Latin, Greek, Cyrillic, and many symbols. CJK and complex scripts such as Arabic or Indic scripts may not render fully, and Docraft warns you after export when characters are unsupported.
  • Preview page breaks are estimates.
  • Landscape mode is manual, and wide tables are scaled with smaller type.

Try it

Docraft installs from source for now:

git clone https://github.com/abmdevx/docraft.git
cd docraft
npm install
npm run build

Then open chrome://extensions, enable Developer mode, choose Load unpacked, and select the generated dist/ folder.

It's MIT licensed, so feedback, issues, and stars are all welcome: https://github.com/abmdevx/docraft

What would you want from a tool like this? Let me know in the comments.

來源:DEV Community · dev.to