Skip to content

About

Lightweight, fast, native VCL Markdown viewer component for Delphi (Delphi 7 - Delphi 13, Win32/Win64) with GFM tables, local images, and HTML export.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

TMarkdownView

English | Русский

A lightweight, fast, native VCL component for Delphi (from Delphi 7 up to Delphi 13) designed to render Markdown documents without relying on heavy external browser engines (such as WebView2 or CEF).

Built on top of the modernized native TRichView core and sgmVersions.

TMarkdownView Demo

Features

  • Headings & Checkpoints (Slugs): Supports heading levels #-###### with automatic checkpoint generation for internal anchor navigation.
  • Inline Formatting: Bold, italic, bold italic, strikethrough, inline code, and proper handling of backslash-escaped characters (\).
  • Links & Callbacks: Supports named links ([text](url)), auto-links (URLs), internal #anchor links, and the OnLinkClick event to intercept navigation.
  • Lists: Ordered (1.) and unordered (-, *, +) lists with multi-level nesting support.
  • GFM Tables: Supports GitHub Flavored Markdown tables (| col1 | col2 |) with column alignment (:---, :---:, ---:), inline cell styling, selection/clipboard copy, and HTML table export.
  • Block Elements & Images: Blockquotes (>), horizontal rules (---, ***), fenced code blocks preserving original formatting and indentation, and local image rendering (![alt](path) including JPEG support in Delphi 7).
  • Paragraphs, Streams & HTML Export: Smart paragraph line joining, direct loading from files or UTF-8 streams (LoadFromStream), and built-in export to HTML (SaveHTML).
  • Wide Compatibility & x86/x64 Support: Compatible with legacy Delphi 7 (Win32) as well as modern Unicode Delphi versions (Win32 & Win64).

Related Projects

  • TRichView Modernized Core - Single-unit native VCL rendering, table, and printing engine used as the foundation for TMarkdownView.
  • MarkdownView TC Plugin - Fast native Lister plugin (wlx / wlx64) for Total Commander (F3 / Ctrl+Q) powered by TMarkdownView.
  • sgmVersions - Cross-version compiler directives include file (Delphi 2 - Delphi 13).

Project Structure

  • src/ - Core source files for TMarkdownView.
  • pkg/ - Component packages for different IDE versions (MarkdownView_D7, MarkdownView_D13, etc.).
  • demo/ (MarkdownViewDemo.dpr / .dproj) - Sample application showcasing live Markdown rendering, link navigation, and HTML export.
  • test/ (MarkdownViewTests.dpr) - DUnit test suite (test\dunit) covering the parser and rendering logic.
  • bin/ & dcu/ - Output directories for compiled binaries (bin\, bin\x64\) and intermediate units (d7, d13\x86, d13\x64).

Quick Start

IDE Installation

  1. Ensure TRichView and sgmVersions are added to your Delphi Search Path.
  2. Open the project group pgMain.groupproj or select the package matching your IDE version inside the pkg/ folder (e.g., MarkdownView_D7.dpk for Delphi 7 or MarkdownView_D13.dproj for Delphi 13).
  3. Right-click the package in the Project Manager and choose Compile, then Install.
  4. Drop TMarkdownView onto your VCL form from the Tool Palette (make sure the src/ path is added to your Delphi Library Path if you want to use it across projects).

Basic Usage

uses
  MarkdownView;

procedure TForm1.LoadDocument;
var
  LStream: TFileStream;
begin
  // Load directly from a file
  MarkdownView1.LoadFromFile('README.md');

  // Or load from a UTF-8 stream
  LStream := TFileStream.Create('README.md', fmOpenRead or fmShareDenyWrite);
  try
    MarkdownView1.LoadFromStream(LStream);
  finally
    LStream.Free;
  end;

  // Or assign Markdown text / TStrings directly
  // MarkdownView1.MarkdownText := '# Hello, World!' + sLineBreak + 'Text with **bold** styling.';
  // MarkdownView1.MarkdownLines := Memo1.Lines;
end;

Handling Link Clicks

procedure TForm1.MarkdownView1LinkClick(Sender: TObject; const URL: string);
begin
  // Handle internal anchor links (#section) or open external URLs in the browser
  ShellExecute(Handle, 'open', PChar(URL), nil, nil, SW_SHOWNORMAL);
end;

Testing

The project includes a DUnit test suite located in test/ (MarkdownViewTests.dpr). To run the tests, open pgMain.groupproj, activate MarkdownViewTests, build, and run the compiled executable from bin\ (Win32) or bin\x64\ (Win64).

License

Distributed under the MIT License. See LICENSE for more information.

About

Lightweight, fast, native VCL Markdown viewer component for Delphi (Delphi 7 - Delphi 13, Win32/Win64) with GFM tables, local images, and HTML export.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages