Why you write in Markdown
Generating an Office document from code usually means one of two things. You run a copy of Office in the background, with its licences and its crashes. Or you write the Office XML (OOXML) by hand and find that Word rejects files the standard allows. Both are a lot of work for a simple job: turn some content into a file someone can open.
With AILANG Parse you write Markdown, which people and language models both write easily, and convert it. The Markdown structure becomes real document structure: bold and italic text, working hyperlinks, embedded images, and tables with merged columns.
How it works
One source file converts to 9 output formats. Headings become slides in PPTX. Tables become sheets in XLSX and ODS. Everything else becomes the closest equivalent in each format.
# Write the document in Markdown, then convert it to any output format.
# Front matter sets the document properties.
cat > report.md <<'MD'
---
title: Q1 Revenue Review
author: Finance
date: 2026-04-02
---
# Q1 Revenue Review
Revenue grew **31%** against a [flat forecast](https://example.com/plan).
| Region | Q4 | Q1 | Change |
|:-------|--------:|--------:|:------:|
| EMEA | 1.20M | 1.61M | +34% |
| AMER | 0.90M | 1.14M | +27% |
> Renewals, not new logos, drove the quarter.
MD
# One source, every output format
docparse report.md --convert report.docx # Word
docparse report.md --convert deck.pptx # headings become slides
docparse report.md --convert report.xlsx # tables become sheets
docparse report.md --convert report.odt # OpenDocument
docparse report.md --convert report.html # HTML
docparse report.md --convert report.qmd # Quarto
# Read the structure back to check it survived —
# "the file opens" is not the same as "the file is correct"
docparse report.docx
You do not need Office or a browser installed. AILANG Parse writes the Office (OOXML) and OpenDocument files itself.
What carries over
Markdown syntax does not appear as literal characters. It becomes real formatting in the output file.
| Markdown | Becomes | Status |
|---|---|---|
| YAML front matter | title/author/date document properties | Preserved |
**bold** *italic* `code` ~~strike~~ | real bold, italic, code and strikethrough text | Preserved |
[text](url) | real hyperlinks (OOXML HYPERLINK fields) | Preserved |
 | image read from disk and embedded | Preserved |
| Fenced code blocks | monospaced code paragraphs | Preserved |
| Blockquotes, nested lists, rules | the format's own quote, list and separator styles | Preserved |
Tables with :---: alignment | a real table with column alignment and merged columns (colspan) | Preserved |
What Markdown can't say
Markdown has no syntax for headers, footers, comments or tracked changes, so you cannot write them this way. They are kept when you convert from a document that already contains them, such as DOCX to DOCX or DOCX to ODT.
| Feature | From Markdown | From a document that has it |
|---|---|---|
| Page headers / footers | No syntax | Preserved |
| Comments with their authors | No syntax | Preserved |
| Tracked changes | No syntax | Preserved |
If a generated document needs a page header, start from a document that has one, or pass a reference doc. Comment extraction and track changes explain how those are kept in a conversion.
Styling from a reference doc
This works like reference-doc in Quarto and Pandoc. An existing .docx supplies the look and your Markdown supplies the content. Use it to put generated content on your letterhead.
docparse annex.md --convert annex.docx --reference-doc letterhead.docx
Everything that is not rewritten is copied from the template unchanged, so an embedded font or a logo comes out exactly as it went in.
The input does not have to be Markdown. A PDF works too: PDF to Word and PDF to PowerPoint show a PDF put into a template, with examples you can open.
No letterhead of your own? Download a free set of Word proposal templates. Each comes with a matching reference document, and the source files are included.
| Part of the document | Comes from |
|---|---|
| Page size, margins, headers, footers, page numbering | the template (its section settings, <w:sectPr>, copied whole) |
| Theme, embedded fonts, logos, settings | the template, copied unchanged |
| Body content, title and author | your document |
styles.xml | the template’s, plus any styles the content needs that the template does not define |
numbering.xml | the template’s, with the list definitions for your content added after its own |
Three things to know before you rely on it:
| Situation | What happens |
|---|---|
| The source document has its own headers or footers | Dropped. The template’s headers and footers are used instead |
| The template has comments | Dropped, along with the template’s text. Comments in the source document are kept |
| The reference doc is missing or is not a DOCX | Error, nothing written. AILANG Parse does not quietly fall back to its built-in styling |
DOCX, PPTX and ODT output.
A template with several sections has several page layouts. By default the last section’s page size, margins, headers and footers are used. --reference-section N picks another one (1 is the first section, as Word numbers them).
--table-style NAME gives generated tables a table style from the template. Without a name, the style called Table is used, or else the first table style the template defines other than Word’s built-in Normal Table. The tables then take their borders from that style.
Over the API
POST /api/v1/convert accepts a document in the same four ways as the parse endpoint: a file upload, a sample ID, an https:// URL, or a gs:// reference on the Business tier. Add a target for the output format.
# Generate a DOCX from Markdown via the hosted API.
# The document comes back inside the JSON, not as a binary body.
curl -s -X POST https://docparse.ailang.sunholo.com/api/v1/convert \
-F "filepath=@report.md" \
-F "target=docx" \
-F "apiKey=$DOCPARSE_API_KEY" > response.json
# `encoding` is load-bearing: "base64" for the six ZIP container targets
# (docx, pptx, xlsx, odt, odp, ods) and "utf8" for the three text targets
# (html, md, qmd). Branch on the field, never on the target.
python3 - <<'PY'
import base64, json
r = json.load(open("response.json"))
# Unwrap the serve-api envelope, same as /api/v1/parse
if isinstance(r.get("result"), str):
r = json.loads(r["result"])
data = (base64.b64decode(r["content"]) if r["encoding"] == "base64"
else r["content"].encode("utf-8"))
open(r["filename"], "wb").write(data)
print(f'{r["filename"]} {r["content_type"]} {r["size_bytes"]} bytes')
PY
# Other input modes — a sample ID, or a URL the server fetches itself
curl -s -X POST https://docparse.ailang.sunholo.com/api/v1/convert \
-H "Content-Type: application/json" \
-d '{"filepath":"sample_docx_tables","target":"html","apiKey":"'"$DOCPARSE_API_KEY"'"}'
curl -s -X POST https://docparse.ailang.sunholo.com/api/v1/convert \
-H "Content-Type: application/json" \
-d '{"sourceUrl":"https://example.com/notes.md","target":"pptx","apiKey":"'"$DOCPARSE_API_KEY"'"}'
The generated document comes back inside the JSON, not as a binary body:
{
"status": "success",
"target": "docx",
"filename": "report.docx",
"content_type": "application/vnd...wordprocessingml.document",
"encoding": "base64",
"size_bytes": 8213,
"content": "UEsDBBQ..."
}
encoding. It is base64 for the six Office and OpenDocument targets (docx, pptx, xlsx, odt, odp, ods) and utf8 for the three text targets (html, md, qmd). Decide how to decode from this field, not from the target name. Decoding utf8 content as base64 gives a corrupt file without an error.Each generated document counts as one request against your plan, the same as a parse. Output size does not affect the cost. A conversion counts against your AI quota only when the source needs AI to read: an image, or a PDF read with the AI backend. Generating from Markdown uses no AI.
For AI agents
Over MCP the tool is mcpConvert. The agent writes the Markdown, then converts it.
mcpConvert(input: "report.md", outputFormat: "docx", apiKey: "dp_...")
Generating a document from a prompt (--generate report.docx --prompt "...") is available in the local CLI only. The hosted API only converts: the same input always gives the same output, at a fixed price. If a user wants a document written from a prompt, write the Markdown and convert it. See the MCP server guide and llms-full.txt.
Try it
Convert any of 17 input formats to any of 9 output formats:
# Markdown to a Word document
curl -X POST https://docparse.ailang.sunholo.com/api/v1/convert \
-F "filepath=@report.md" -F "target=docx" -F "apiKey=YOUR_API_KEY"
# Or convert a built-in sample, no upload needed
curl -X POST https://docparse.ailang.sunholo.com/api/v1/convert \
-H "Content-Type: application/json" \
-d '{"filepath":"sample_docx_tables","target":"pptx","apiKey":"YOUR_API_KEY"}'
Frequently Asked Questions
How do I generate a DOCX from Markdown?
Run docparse report.md --convert report.docx, or POST the file to /api/v1/convert with target=docx. Front matter becomes document properties, and bold, links, images and tables become real Word formatting.
Can I convert Markdown to PowerPoint?
Yes. docparse notes.md --convert slides.pptx turns headings into slides and puts tables, lists and images on them. The same source file also converts to XLSX, ODT, ODP, ODS, HTML and Quarto.
Can generated documents have headers, footers or tracked changes?
Not from Markdown, which has no syntax for them. They are kept when you convert from a document that already contains them, such as DOCX to DOCX or DOCX to ODT.
Can AILANG Parse write a document from a prompt?
The local CLI can, with --generate, --prompt and an AI model. The hosted API cannot: /api/v1/convert only converts. Have your own model write the Markdown, then convert it.
Do I need Microsoft Office or LibreOffice installed?
No. AILANG Parse writes the Office and OpenDocument files itself. Nothing from Microsoft or LibreOffice runs, and no Office licence is needed.