Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
DelphiHow-To'sNewsTech Partner

Markdown4D, and how we built it with AI

Markdown4D free markdown component

Here’s a guest blog post by Marco Geuze, Embarcadero MVP and founder of Embarcadero Tech Partner GDK Software.

At GDK Software we have been using AI tools to help us develop for a few years now. Two years ago that was occasional; today every developer works with AI.

If you do a lot with AI, you know these systems like to work in markdown. Markdown is a simple way to format text: with a few tags you get a list, headings or a table. Every modern (web) system supports it.

Delphi, however, had no component that could display and render markdown for both VCL and FireMonkey, let alone one that could show markdown while it streams in.

So, we built one ourselves and published it on GitHub: github.com/GDKsoftware/Markdown4D

This article is about how we built the more than 40,000 lines of library code with Claude Code.

Markdown4D: Markdown on a canvas

If you wanted to use markdown in Delphi, you had two options. You could convert the markdown to HTML with some open source tool, and render that HTML in a browser component. Or you removed the formatting and just showed the plain text. The first solution was heavy and clumsy, and with the second one you miss functionality. Besides that, with both of them it was not possible to render while the text is still coming in (streaming).

Markdown4D solves both problems. It is a CommonMark and GFM library, written for Delphi, without external libraries or dependencies. The library gives you an IMarkdownDocument that you use very easily and with which you can do all the actions you need. Incremental parsers are available, to only read the changed pieces again. We have a TMarkdownViewer and a TMarkdownEditor, for VCL as well as FMX, and with the same API. The functionality is extensive: theme support, selection, search, syntax colouring in code blocks and a preview on the form designer. Charting is also handled, with support for bar, line, pie or scatter diagrams, and even mermaid diagrams are natively in there.

To start, you can simply create the component at runtime:

The rendering is native, no browser needed. The layout engine handles the layout, and the painter draws it on the canvas. This is why Markdown4D is blazingly fast, as you are used to from Delphi.

And then the part we built the library for:

If you work with AI (and who doesn’t nowadays) you know that language models return text incrementally. As a user you do not want to wait until an AI has finished a complete answer, you want to see what happens. With Markdown4D you can implement this very simply. And a chunk does not even have to be complete. It can be a part of a word, a bold span, or even a table. The incremental parser of Markdown4D makes sure the rendering is correct while the chunks come in.

Under the hood, no third party code is used. Up to and including the anti-aliased rasterizer and the SVG engine behind the viewers, everything is native code. Because of this, installing is very easy, just add it to your search path. If you want the design-time components available, you can just open the packages and install them.

Markdown4D Studio: markdown source on the left, the rendered document on the right, with a table, a chart and a mermaid diagram appearing while the text streams in

How we developed this

The Markdown4D library was built with the help of Claude Code, where we used the extensive scaffolding and guidelines we developed as a toolset within GDK Software. Without all the tools, with just Claude Code, the code does not meet the requirements we set for ourselves, and there would never have been a full component. But with all the knowledge and the tools we developed, this library came about without too much human effort.

If you want to be able to develop this yourself too, or if you want to use this knowledge to extend your own applications faster and better, we have developed a training to pass this knowledge on.

The training

The training Claude Code for Delphi is a one-day training for a maximum of twenty participants. We explain how we work with AI at GDK Software, and you get all the tools and skills to take with you, tuned to your own codebase. If you want to be there, you can. The following days are planned:

  • Monday 26 October 2026, Utrecht (in Dutch)
  • Thursday 29 October 2026, Frankfurt
  • Wednesday 11 November 2026, London
  • Tuesday 1 December 2026, Ruhr area
  • Tuesday 12 January 2027, Leipzig
  • Tuesday 26 January 2027, Southern Germany
  • Tuesday 9 February 2027, Fredericia, Denmark

Programme and registration: training.gdksoftware.com.

Kai 1.1 Now Available! What's Coming in RAD Studio 13.2 Florence

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.

Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES