feat(md-to-docx): accept pasted Markdown text as input - #618
Merged
Durgeshwar-AI merged 2 commits intoAug 7, 2026
Conversation
/convertMdToDocx only accepted a .md upload, so anyone who already had the Markdown on their clipboard had to save it to a file just to convert it. - Resolve the Markdown in the markdown_docx blueprint through the shared resolve_markdown_input() validator, so the endpoint accepts either an uploaded .md file or a `text` form field; pasted text downloads as document.docx and the existing upload flow is unchanged - Add an "Upload .md file" / "Paste Markdown" switch to the tool page, with the Convert button disabled until Markdown text is entered - Cover the new input path with backend and frontend tests, and document it in the Readme Closes Durgeshwar-AI#566
|
@Anijesh is attempting to deploy a commit to the Durgeshwar's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔀 Pull Request
📌 Issue Reference
Closes #566
📝 Summary
What issue does this fix?
The Markdown → DOCX tool only accepted a
.mdfile upload. Since the Markdown is usually already on the clipboard (or being tweaked right before conversion), users had to save it to a file first just to convert it. This adds a plain text input as an alternative source.What major changes were made?
Backend
/convertMdToDocx(backend/blueprints/markdown_docx.py) now resolves its input through the sharedresolve_markdown_input()validator, so it accepts either the uploadedfileor a newtextform field. Pasted Markdown downloads asdocument.docx; the existing upload flow, the.mdextension check and the UTF-8 decode error are unchanged, and blank / whitespace-only text is rejected with400.Frontend
MdToDocx.tsxnow shows an "Upload .md file" / "Paste Markdown" switch. In text mode the drop area is replaced by a Markdown textarea, and the Convert button stays disabled until something is typed. Switching modes clears the input from the mode you left, so only one source is ever active.📸 Screenshots (if applicable)
Verified against the running endpoint rather than screenshots:
The generated
.docxis a real Word document — unzipping it shows the converted headings and body text inword/document.xml.✅ Checklist
🔗 Related Issues / PRs
Issue #566
Depends on #617 (issue #565), which introduces the shared
resolve_markdown_input()validator and the optionalToolPageTemplateprops this PR builds on. This branch is stacked on top of it, so the diff here shows both commits until #617 is merged — after that it reduces to the DOCX-only changes automatically. Please merge #617 first.🏅 Open Source Program Participation
Program Name: GSSoC '26
💬 Additional Notes
backend/test_blueprints.py(text input success, blank text rejected, empty request rejected) and a newfrontend/src/tests/mdToDocxTextInput.test.tsxwith 4 tests covering the mode switch.pytestis at 86 passing with no new failures (the 2 pre-existingadd_watermarkfailures are untouched) andvitestat 17 passing.npm run lint,npm run typecheckandnpm run buildare all clean.Readme.mdfeature list previously had no entry for Markdown → DOCX at all; this PR adds one.