zhangjing361/wengao-box

Productivity & Utilities

Convert Markdown or AI-written text into an editable Word document locally in the browser, with Chinese typesetting presets.

113
2
JavaScript
MIT
2 days old

What it does

Wengao Box turns existing Markdown text—including answers copied from an AI assistant—into a .docx file you can keep editing. It is aimed at people who need a usable Word draft without manually rebuilding headings, lists and tables.

Parsing and DOCX generation happen in the browser. The README states that document text stays in page memory: it is not uploaded, sent to a model or stored in localStorage. The preview is a styled rendering, not a page-accurate Word simulation.

Supported input includes levels 1–6 headings, paragraphs, bold/italic/strikethrough, ordered and unordered lists up to three levels deep, pipe tables, inline and fenced code, quotes and horizontal rules. Two A4 Chinese templates are provided: a general document and a course report. Both rely on locally installed fonts.

Quick start

The published repository does not include a demo URL, so the documented path is to run it locally. Node.js 22.12+ is required, with Node.js 24 recommended.

npm ci
npm run dev

Open the local address printed in the terminal. The source cannot be opened by double-clicking index.html; it needs the development server or a build. If you have an online deployment, the in-product flow is: click 载入示例 (load sample), choose 普通文档 or 课程报告, enter a filename, then click 下载 Word and open the resulting .docx in a word processor. A sample Markdown file and an exported Word example are available in the repository.

To produce a static deployment:

npm run build
npm run preview

The generated dist/ folder can be hosted on a static server, and relative asset paths make it usable under a GitHub Pages repository subpath. Deployment notes are in the deployment guide.

Limits to know

  • There is no automatic save. Refreshing or closing the page can lose unsaved text; a browser leave warning is attempted but not guaranteed.
  • Images and links are not fetched or embedded. Images are kept as descriptions and addresses, and links become name-plus-address text. HTML is treated as text, not executed.
  • LaTeX math stays as plain text. Footnotes, complex charts, rich clipboard formatting and complex Markdown extensions are not promised.
  • Input is capped at 100,000 JavaScript UTF-16 characters and 500 block elements. A table may have at most 30 columns and 200 rows including the header; rows wider than the header cause conversion to be rejected rather than silently losing cells.
  • The course report template is only a general layout preset and does not represent any school's formatting standard. Fonts are not embedded, so results depend on fonts available on the machine opening the file.
  • Exported files contain no macros or remote image relationships, but the tool does not verify the credibility of the document text or addresses it contains.

Development and testing

npm test
npm run build
npm audit

Browser tests use the local Edge browser by default via npm run test:browser; Chromium can be substituted after npx playwright install chromium, setting PW_CHANNEL=chromium (on Windows PowerShell, $env:PW_CHANNEL='chromium'; npm run test:browser). Test coverage and unverified environments are described in the QA record. Code is split between parser.js for the shared document structure, preview.js for safe DOM preview construction, exporter.js for DOCX generation and templates.js for layout presets.

Licensing and contribution

The project is MIT-licensed; third-party dependency licensing is recorded in the full notice. Contributions are requested as de-identified, reproducible inputs with expected output and actual screenshots—not real student information, company material, passwords or API keys.

HotRepo's take

The project appeared on HotRepo's new-project list for JavaScript on 2026-11-02, reporting 4 new stars over a roughly two-hour observation window, with the collected star count rising from 108 to 112. That is a small sample from a single day and does not show a sustained trend. What stands out in the supplied material is the unusually concrete boundary documentation: character and table limits, no autosave, no font embedding, and rejection instead of silent cell loss when a table row is wider than its header. For an audience that needs a lightweight, client-side Markdown-to-Word step, these constraints are the useful part to check before adopting it.

Written by AI from the project's README, updated . The project's own docs are the source of truth.