convert_to_rtf
Convert Markdown to Rich Text Format (RTF) for legacy word processors and email clients. Preserves bold, italic, headers, lists, and code blocks. Returns string or saves to file.
Instructions
Convert Markdown to Rich Text Format (RTF). Produces an RTF document string preserving basic formatting: bold, italic, headers (as styled paragraphs), lists, and code blocks. Side effects: when output_path is provided, writes the RTF file to disk (creates parent directories, overwrites existing files). When output_path is omitted, returns the raw RTF markup as a string. Returns: RTF markup string (if no output_path), or JSON { success, file_path, file_size_bytes, format } (if output_path set). Use this when the target application requires RTF (e.g. legacy word processors, email clients). Prefer convert_to_docx for modern Word documents, or convert_to_html for web display.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| markdown | Yes | The raw Markdown source text to convert. Supports GitHub-Flavored Markdown (tables, task lists, strikethrough) and KaTeX math expressions. Pass the full document content as a string, not a file path. | |
| output_path | No | Optional. Absolute or relative file path (e.g. './output.txt') where the result will be saved. Parent directories are created automatically. If omitted, the converted text content is returned directly in the response as a string. If provided, the file is written to disk and a JSON summary with { success, file_path, file_size_bytes, format } is returned instead. |