# Markdown4D **Repository Path**: yangyxd/Markdown4D ## Basic Information - **Project Name**: Markdown4D - **Description**: delphi markdown - **Primary Language**: Delphi - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-09-16 - **Last Updated**: 2026-09-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Markdown4D Markdown4D is a CommonMark / GFM markdown library written in Delphi. It parses markdown into a typed AST, renders HTML, writes markdown back out, and ships custom-drawn viewer and editor components for VCL and FMX. Everything is plain Object Pascal on top of the RTL; rendering happens on a canvas, without an embedded browser. [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) [![Latest release](https://img.shields.io/github/v/release/GDKsoftware/Markdown4D?label=release&color=blue)](https://github.com/GDKsoftware/Markdown4D/releases) [![Delphi 12+](https://img.shields.io/badge/Delphi-12%2B-e62329.svg)](https://www.embarcadero.com/products/delphi) [![CommonMark 0.31.2](https://img.shields.io/badge/CommonMark-0.31.2%20652%2F652-1f6feb.svg)](https://spec.commonmark.org/0.31.2/)

Markdown4D Studio in the light theme, markdown source on the left and a rendered report with a table and a bar chart on the right Markdown4D Studio in the dark theme, showing a mermaid flowchart, syntax-highlighted Pascal, a task list and a block quote

*Markdown4D Studio, the editor example, in the light and the dark theme. Source on the left, `TMarkdownEditor`; rendered document on the right, `TMarkdownViewer`. The table, the bar chart, the flowchart and the highlighted code are all drawn on the canvas from the markdown you see next to them.* ## Why Markdown4D Markdown is a handy way to give plain text a visual shape, and Delphi had no component that rendered it well, at runtime or on the form designer. So we built one, starting from a parser rather than a shortcut: Markdown4D passes all 652 official CommonMark examples, and the library is interface-based throughout, handing you a typed `IMarkdownDocument` rather than a string of HTML. VCL and FMX are both supported, with no external dependencies. Charts and mermaid diagrams are drawn natively, alongside the usual markdown constructs: tables, task lists, links, raw HTML. The pipeline builder accepts inline and block syntax of your own. The renderer turns a document into HTML, the writer turns it back into markdown, so a round trip through the tree gets you clean markdown out the other end. And it streams, if that is what you need. An incremental parser reparses only the region that changed. That is what makes streaming practical: a log that grows, an import reporting as it runs, a model answering a token at a time. It is also what keeps an editor responsive on a large document. Everything under `Source\` was written for this project and uses only the RTL: no DLL of its own, no package manager involved. Delphi 12 Athens and Delphi 13, MIT licensed. ## Features | Area | What you get | |------|-------------| | CommonMark 0.31.2 + GFM | 652/652 official examples; tables, task lists, strikethrough, extended autolinks | | Public AST | Typed node interfaces, a visitor, and a round-trip writer back to clean markdown | | Incremental parser | Reparses only the changed region, which is what keeps an editor fast and a stream practical | | VCL & FMX viewer and editor | One API on both frameworks: theming, selection, find, syntax-highlighted source, a live preview | | Chart extension | `chart` fences drawn natively: bar, line, pie, doughnut, radar, scatter | | Mermaid extension | `mermaid` fences drawn natively: flowchart, sequence, pie | | Raw HTML in the viewer | The allowed subset renders through the ordinary path; `