# create-document
Create a document from markdown.
## Synopsis
```
datalab create-document [OPTIONS] --markdown <MARKDOWN>
```
## Description
Generate a Microsoft Word document (.docx) from markdown content. Useful for programmatic document generation and templating.
---
## Options
### Input Options
| `--markdown <MARKDOWN>` | Markdown content or path to markdown file **(required)** |
### Output Options
| `--output-format <FORMAT>` | Output format (currently only `docx`) | `docx` |
| `-o, --output <FILE>` | Write created document to file |
### Cache Options
| `--skip-cache` | Skip local cache lookup |
### Advanced Options
| `--timeout <SECS>` | Request timeout in seconds | `300` |
---
## Examples
### From Inline Markdown
```bash
datalab create-document \
--markdown "# Report Title\n\nThis is the content." \
--output report.docx
```
### From Markdown File
```bash
datalab create-document --markdown content.md --output document.docx
```
### Complex Document
```bash
cat << 'EOF' > report.md
# Quarterly Report
## Executive Summary
This quarter showed strong performance across all metrics.
## Key Metrics
| Revenue | $1.2M | +15% |
| Users | 50,000 | +22% |
| Retention | 85% | +3% |
## Conclusion
The team delivered excellent results.
EOF
datalab create-document --markdown report.md --output report.docx
```
---
## Supported Markdown Features
| Headings (H1-H6) | Yes |
| Bold, italic | Yes |
| Lists (ordered/unordered) | Yes |
| Tables | Yes |
| Code blocks | Yes |
| Links | Yes |
| Images | Yes |
| Block quotes | Yes |
| Horizontal rules | Yes |
---
## Output
When using `--output`, the document is saved to the specified file.
The JSON response includes:
```json
{
"output_base64": "UEsDBBQAAAAI...",
"metadata": {
"pages": 2,
"processing_time": 0.8
}
}
```
Without `--output`, the base64-encoded document is included in the JSON output.
---
## Related Commands
- [`convert`](convert.md) - Convert documents back to markdown
- [`track-changes`](track-changes.md) - Extract changes from Word documents
---
## See Also
- [Output Formats](../concepts/output-formats.md)