The official Free Pascal wiki is back.

This copy is only for testing and development, and it may be out of date. Please read and edit the wiki at wiki.freepascal.org.

Go to the official wiki →

LazInk: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11**LazInk** is an open-source collection of HTML and Markdown text controls for the [[Lazarus]] IDE and [[Free Pascal]]. The library provides formatted labels, editable text fields, list boxes, scrollable document viewers, and a WYSIWYG Markdown editor.
22
33Unlike conventional rich-text controls, LazInk renders its content directly onto the LCL `TCanvas`. It does not require a web browser engine, RichMemo, external rendering libraries, or widgetset-specific text backends.
44
55- **Project:** [LazInk on GitHub](https://github.com/TonyStone31/LazInk)
66- **Developer:** Tony Stone
77- **License:** BSD Zero Clause (0BSD)
88- **Current version:** 1.0.0.0
99- **Language:** Object Pascal
1010- **Dependencies:** Lazarus Component Library (LCL)
1111
1212[[File:LazInk TInkPage help site.png|thumb|420px|A help site drawn by TInkPage, in the LazInk demo]]
1313
1414## Overview
1515
1616LazInk was developed to provide consistent, formatted text rendering across Lazarus applications without relying on platform-specific rich-text widgets.
1717
1818All seven controls use canvas-based drawing. The library includes its own document parsing, layout, text rendering, Markdown processing, and image decoding capabilities.
1919
2020LazInk supports both small pieces of inline HTML and complete documents containing headings, tables, lists, syntax-highlighted code, images, and CSS styling.
2121
2222A particular feature is `TInkRichEdit`, which allows users to edit formatted Markdown visually instead of editing its source syntax.
2323
2424## Features
2525
2626- Canvas-based text rendering without an embedded browser.
2727- HTML and GitHub Flavored Markdown support.
2828- WYSIWYG Markdown editing.
2929- CSS-styled HTML document rendering.
3030- Syntax-highlighted code blocks.
3131- PNG, animated GIF, and WebP image support.
3232- Text selection, clipboard operations, and keyboard navigation.
3333- Zoom and touch scrolling.
3434- Light and dark color-scheme support.
3535- Interactive links and document navigation.
3636- Cross-platform architecture using the Lazarus LCL.
3737- No third-party runtime dependencies.
3838
3939## Components
4040
4141Installing LazInk adds seven controls to the **LazInk** component palette.
4242
4343| Component | Description |
4444| -------------- | --------------------------------------------------------------------------------------------- |
4545| `TInkLabel` | Displays a caption with inline HTML formatting, links, wrapping, and optional text selection. |
4646| `TInkEdit` | Single-line editor supporting per-character styling, selection, and undo/redo. |
4747| `TInkMemo` | Scrollable formatted text viewer for logs, messages, transcripts, and streaming content. |
4848| `TInkListBox` | List box displaying formatted text with selectable and editable entries. |
4949| `TInkRichEdit` | WYSIWYG rich-text editor supporting Markdown input and output. |
5050| `TInkCodeMemo` | Plain multiline editor with optional character styling and automatic height adjustment. |
5151| `TInkPage` | Complete HTML and Markdown document viewer with CSS, images, links, and navigation. |
5252
5353### TInkLabel
5454
55+[[File:LazInk TInkLabel and TInkEdit.png|thumb|380px|TInkLabel, TInkEdit and TInkCodeMemo]]
56+
5557`TInkLabel` is an alternative to `TLabel` for applications requiring formatted captions.
5658
5759It supports inline HTML markup, including font styling, foreground and background colors, links, and text decoration.
5860
5961```pascal
6062InkLabel1.Caption :=
6163 'Status: <b><font color="#00AA00">Connected</font></b>';
6264```
6365
6466Additional features include word wrapping, automatic sizing, alignment, ellipsis handling, and optional text selection.
6567
66-[[File:LazInk TInkLabel and TInkEdit.png|thumb|420px|TInkLabel, TInkEdit and TInkCodeMemo]]
67-
6868### TInkMemo
6969
70+[[File:LazInk TInkMemo.png|thumb|380px|TInkMemo]]
71+
7072`TInkMemo` displays formatted text in a scrollable control.
7173
7274It is useful for application logs, chat interfaces, debugging output, and other situations where formatted entries are added dynamically.
7375
7476```pascal
7577InkMemo1.TextFormat := itfMarkdown;
7678InkMemo1.Append('**12:04** Build finished, `0 errors`');
7779```
7880
7981The `AppendBlock` method can insert complete formatted messages, including lists, tables, and highlighted code.
8082
8183`ReplaceLast` allows applications to update the most recent message as additional content arrives, making the control useful for streaming AI responses.
8284
83-[[File:LazInk TInkMemo.png|thumb|420px|TInkMemo]]
84-
8585### TInkRichEdit
8686
87+[[File:LazInk TInkRichEdit editor.png|thumb|380px|The WYSIWYG Markdown editor, TInkRichEdit]]
88+
8789`TInkRichEdit` is a WYSIWYG rich-text editor capable of reading and writing Markdown.
8890
8991It supports:
9092
9193- Bold, italic, underline, and other character formatting.
9294- Font colors, sizes, and backgrounds.
9395- Headings and paragraph alignment.
9496- Nested ordered and unordered lists.
9597- Block quotations.
9698- Tables.
9799- Fenced code blocks.
98100- Hyperlinks.
99101- Undo and redo.
100102- Search within the document.
101103
102104Unlike a conventional Markdown source editor, `TInkRichEdit` allows users to work directly with the rendered document.
103105
104106```pascal
105107InkRichEdit1.LoadMarkdown(
106108 '## My Document' + LineEnding +
107109 'This is **bold** and *italic* text.'
108110);
109111```
110112
111113The edited document can be retrieved as Markdown:
112114
113115```pascal
114116Memo1.Lines.Text := InkRichEdit1.AsMarkdown;
115117```
116118
117-[[File:LazInk TInkRichEdit editor.png|thumb|420px|The WYSIWYG Markdown editor, TInkRichEdit]]
118-
119119### TInkPage
120120
121+[[File:LazInk Markdown source and preview.png|thumb|380px|Markdown source on the left, the page drawn from it on the right]]
122+
121123`TInkPage` is a lightweight document viewer for displaying HTML and Markdown inside Lazarus applications.
122124
123125```pascal
124126InkPage1.LoadFromFile('help/index.html');
125127```
126128
127129The control includes a document tree, CSS processing, layout engine, image decoding, hyperlinks, history navigation, search, text selection, and zoom.
128130
129131Supported content includes headings, tables, nested lists, code blocks, images, and styled document elements.
130132
131133CSS capabilities include selectors, the cascade, box layout, borders, backgrounds, tables, flex and grid layouts, and media queries.
132134
133135Unlike a web browser, `TInkPage` does not execute JavaScript.
134136
135137Applications can modify the document through its DOM-style API and refresh the displayed content.
136138
137139This makes it suitable for embedded help systems, documentation viewers, release notes, and application dashboards.
138140
139-[[File:LazInk Markdown source and preview.png|thumb|420px|Markdown source on the left, the page drawn from it on the right]]
140-
141141### Other controls
142142
143+[[File:LazInk TInkListBox.png|thumb|380px|TInkListBox]]
144+
143145`TInkEdit` provides a single-line text editor with per-character colors and styles supplied by an event. This can be used for syntax coloring and other character-level visual feedback.
144146
145147`TInkCodeMemo` is a plain multiline editor with character styling, word wrapping, undo, and automatic height adjustment.
146148
147149`TInkListBox` provides formatted list entries, text selection, optional alternating backgrounds, and in-place editing.
148150
149-[[File:LazInk TInkListBox.png|thumb|420px|TInkListBox]]
150-
151151## Installation
152152
1531531. Download or clone the [LazInk repository](https://github.com/TonyStone31/LazInk).
1541542. Open Lazarus.
1551553. Select **Package → Open Package File (.lpk)**.
1561564. Open `lazink.lpk` from the downloaded directory.
1571575. Compile the package.
1581586. Select **Use → Install**.
1591597. Rebuild or restart Lazarus as prompted.
160160
161161The components will appear on the **LazInk** tab of the component palette.
162162
163163## Demonstration application
164164
165165The repository includes a demonstration application at:
166166
167167`demo/lazinkdemo.lpi`
168168
169169Open this project in Lazarus to explore the controls and their features.
170170
171171The demonstration is built using the Lazarus form designer and includes a separate tab for each component.
172172
173173## Supported platforms
174174
175+[[File:LazInk TInkRichEdit on macOS.png|thumb|380px|The editor running on macOS]]
176+
175177LazInk is designed around the Lazarus LCL and avoids widgetset-specific rendering implementations.
176178
177179The current project documentation reports testing on:
178180
179181| Platform | Environment |
180182| ------------ | ------------------------------ |
181183| Linux x86-64 | GTK3, Lazarus trunk, FPC 3.3.1 |
182184| macOS Intel | Cocoa, Lazarus 4.8, FPC 3.2.4 |
183185
184186The macOS tests were performed using macOS Sequoia 15 in an Intel virtual machine.
185-
186-[[File:LazInk TInkRichEdit on macOS.png|thumb|420px|The editor running on macOS]]
187187
188188Other Lazarus widgetsets are intended to be supported through the shared LCL drawing architecture, but compatibility should not be assumed without testing.
189189
190190The project is currently usable, although APIs may change as development continues.
191191
192192## Documentation
193193
194194Additional technical documentation is available in the project repository:
195195
196196- [README](https://github.com/TonyStone31/LazInk/blob/master/README.md) — project overview, features, and installation.
197197- [Complete guide](https://github.com/TonyStone31/LazInk/blob/master/docs/GUIDE.md) — detailed documentation of controls, events, properties, markup, and examples.
198198- [HTML and CSS support](https://github.com/TonyStone31/LazInk/blob/master/docs/HTML_SUPPORT.md) — supported document elements and styling capabilities.
199199- [Source code](https://github.com/TonyStone31/LazInk) — complete Object Pascal implementation.
200200- [Issue tracker](https://github.com/TonyStone31/LazInk/issues) — bug reports and feature requests.
201201
202202## License
203203
204204LazInk is released under the **BSD Zero Clause License (0BSD)**, a permissive open-source software license.
205205
206206Some bundled reference data and decoder tables have separate attribution requirements documented in the repository's `LICENSES/THIRD-PARTY.md`.
207207
208208Applications incorporating the WebP decoder through `TInkPage` should retain the applicable RFC 6386 notice as described by the project.
209209
210210## See also
211211
212212- [[Lazarus]]
213213- [[Lazarus Packages]]
214214- [[How To Write Lazarus Component]]
215215- [[Projects using Lazarus - Components and Libraries]]
216216
217217Category:Lazarus
218218Category:Components

Back to history