convert_to_html
Transform Markdown into complete HTML documents with embedded stylesheets and KaTeX math rendering. Converts GitHub-Flavored Markdown including tables and task lists to standalone files or direct HTML strings.
Instructions
Convert Markdown to a complete, styled HTML document. Renders GFM (tables, task lists, strikethrough) and KaTeX math into semantic HTML with an embedded stylesheet for clean presentation. The output is a full document with (charset, KaTeX CSS CDN link, inline styles) and . Side effects: when output_path is provided, writes the HTML file to disk (creates parent directories, overwrites existing files). When output_path is omitted, returns the full HTML string directly. Returns: HTML document string (if no output_path), or JSON { success, file_path, file_size_bytes, format } (if output_path set). Use this when you need a file saved to disk or when you need the full document. Prefer generate_html if you only need the HTML string returned directly (no file I/O) and want inline styles without a CDN link. Prefer convert_to_pdf for print-ready output, or convert_to_image for a visual snapshot.
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. |