MD Formatter icon

MD Formatter

Parse and format text/markdown/JSON to pretty Markdown and JSON

MD Formatter

AI-generated

Summary

Parse input content from JSON or Markdown, apply formatting and structural detection, then output formatted Markdown text and optionally corresponding JSON in various structured formats.

Inputs

  • Source Type (required) — Select input content type: Auto Detect, JSON, or Text/Markdown.
  • Content Field (required) — Specify the expression to extract the content to be parsed and formatted; commonly a JSON field or string input.
  • Format Style (required) — Choose formatting style: Pretty for human-readable Markdown or Strict for machine-friendly formatting.
  • Include Front Matter (YAML) — Optionally include YAML front matter in the formatted output.
  • Detect Structure (Chapters/Pages) — Enable to automatically detect document structure such as chapters or pages.
  • Normalize Escapes (\n, \t, \r) — Normalize common escape sequences in the input content.
  • Strip Code Fences (```) — Remove Markdown code fences from the content if set.
  • Advanced Mapping (Match Target Sections) — Enable advanced matching of target sections for mapping content fields.
  • Parse Nested Structures (#### within ###) — Parse nested Markdown subsections as arrays of objects with key-value pairs extracted from bullet points.
  • Header Case Style (required) — Set field names casing style in section headers: snake_case or Title Case.
  • Aggressive Header/Footer Cleanup — Remove common repeating headers/footers and page numbers aggressively.
  • Repeated Header/Footer Threshold (required) — Minimum repetition count for headers/footers to be removed.
  • Custom Header/Footer Regex Patterns — Define custom regex patterns (one per line) to identify headers/footers for removal.
  • Title Field — Specify which field from the parsed data to use as the main document title; supports special formats or auto-detection if empty.
  • Title Suffix — Text appended to the title field value to form the document title.
  • Start Delimiter — String marking the start of the content segment to process.
  • End Delimiter — String marking the end of the content segment to process.
  • Export JSON — Enable exporting a JSON representation of the parsed Markdown content alongside the formatted Markdown.
  • Export Mode (required) — Select JSON export structure: Field-Mapped, SQL Ingest, Single JSON Field, or Flat Columns.
  • Single JSON Field Name — Name of the single JSON field when using Single JSON Field export mode.
  • Flat Column Prefix — Prefix to use when exporting flat columns in JSON.
  • SQL Table Name — Name of the SQL table when using SQL Ingest export mode.
  • Export .md File — Enable to output the formatted Markdown as a binary .md file.
  • File Name — Filename pattern or expression for the exported Markdown file.
  • Debug Mode (include parsing info in markdown) — Include internal parsing details and metadata in the exported Markdown for debugging purposes.

Output shape

a list of items, each containing the original input JSON with added 'markdown' field holding the formatted Markdown text; optionally including additional JSON-structured fields (fieldMapped, sqlIngest, single JSON field, or flatColumns) and a binary .md file when file export is enabled.

Output JSON format depends on the selected Export Mode. If Export JSON is enabled, various structured JSON representations of the parsed content are included. Exported Markdown file binary data is added under the 'binary.data' field when Export .md File is true. The operation supports multiple input items, processing each independently. Debug information can be included in the Markdown output if Debug Mode is enabled.

Discussion