Rich-Text Paste & Document Upload
The Backlog.md Web interface editor supports one-click conversion of external rich-text content to Markdown, including paste from Word, Google Docs, and webpages, as well as uploading .docx files. It also supports screenshot paste, automatically uploading images and embedding them into the task body.
Paste as Markdown
In the Markdown editing area of the task editor, copy and paste content directly from an external source. The editor automatically recognizes rich-text HTML and converts it to clean Markdown.
Supported Sources
| Source | Converted Content |
|---|---|
| Microsoft Word | Paragraphs, headings, lists, tables, bold/italic/underline |
| Google Docs | Paragraphs, headings, lists, tables, formatting |
| Excel | Tables (including header detection) |
| Webpages | HTML structure, links, lists, tables |
| Screenshots | image/png images, uploaded automatically |
Paste Flow
- Select content in the external app and copy.
- Press
Ctrl+V(orCmd+V) in the Backlog.md editor. - The editor reads
text/htmlfrom the clipboard. - Word/Excel-specific markup is cleaned (noisy tags, inline styles,
mso-list, etc.). - If images are present, they are extracted and uploaded to a temporary directory.
- Turndown converts the cleaned HTML to Markdown.
- The conversion result is inserted at the editor cursor position.
If the clipboard does not contain HTML (plain text only), the editor falls back to native paste behavior without extra processing.
Upload Word Documents
In addition to clipboard paste, the editor supports direct upload of .docx files. This is especially useful for documents with many images or complex formatting.
How to Use
In the task editor:
- Click the "Upload Word" button in the editor toolbar and select a local
.docxfile. - Or drag and drop a
.docxfile directly into the editor area.
Conversion Flow
- The front end sends the
.docxfile to the back end viaPOST /api/docx/convert. - The back end uses the
mammothlibrary to parse the document and extract text content as HTML. - Embedded images in the document are extracted and uploaded to
backlog/assets/.temp/. - The back end returns the raw HTML, image list, and conversion warnings.
- The front end uses the exact same
cleanHtml+ Turndown pipeline as "Paste as Markdown" to convert the HTML to Markdown. - Image references are embedded in the body as
/assets/.temp/{uuid}.png.
Unified Pipeline Ensures Consistency
Word document upload and rich-text paste share the same front-end conversion logic, ensuring consistent output formats. For complex tables, nested lists, and similar scenarios, the unified pipeline avoids format differences that could arise from back-end direct conversion.
Image Handling
Screenshot Paste
When pasting a screenshot directly (such as from QQ/WeChat or system screenshot tools):
- The image is uploaded as an
image/pngblob. - It is saved to
backlog/assets/.temp/{uuid}.png. - A preview thumbnail is shown in the editor.
Webpage Images
When pasted content contains <img> tags from a webpage:
- Data URI images: base64 data is extracted and uploaded to the temporary directory.
- HTTP(S) URL images: downloaded securely by the back end and then uploaded.
file://local paths: rejected (browser security restriction).
Promote on Save
All temporary images (including pasted screenshots and images extracted from Word documents) are automatically promoted when the task is saved:
- The front end scans Markdown for
/assets/.temp/references. - It calls
POST /api/assets/promoteto move files in batches. - Images are moved from
.temp/to the permanentpaste/directory. - The front end updates URL mappings in the Markdown and then performs the save.
Expired files in the temporary directory (older than 30 minutes) are automatically cleaned up when the server starts.
Limitations and Notes
- File size: single files over 20MB return an error.
- Format support: only
.docxfile upload is supported; older.docfiles must be converted first. - Corrupted documents: unreadable documents show a readable error message instead of crashing.
- Image size: if a single image exceeds the size limit, it may be skipped or cause the overall operation to fail (depending on policy configuration).