harmonize_markdown
Normalize Markdown formatting by converting headers to ATX style, standardizing list markers to dashes, and enforcing fenced code blocks. Returns consistent syntax or saves to file.
Instructions
Standardize and normalize Markdown syntax without changing the document's meaning. Re-formats headers (ATX-style), normalizes list markers to '-', enforces fenced code blocks with backticks, and applies consistent indentation. Side effects: when output_path is provided, writes the harmonized Markdown to disk (creates parent directories as needed, overwrites existing files). When output_path is omitted, returns the harmonized text as a string with no file I/O. Returns: harmonized Markdown string (if no output_path), or JSON with { success, file_path, file_size_bytes, format } (if output_path set). Use this tool when you need to clean up inconsistent Markdown formatting before further processing. Prefer convert_to_md with harmonize=true if you also need to save the result, as it combines both steps. Not suitable for converting Markdown to other formats — use the convert_to_* tools instead.
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. |