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 1 to 2. 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
12+[[File:LazInk TInkPage help site.png|thumb|420px|A help site drawn by TInkPage, in the LazInk demo]]
13+
1214## Overview
1315
1416LazInk was developed to provide consistent, formatted text rendering across Lazarus applications without relying on platform-specific rich-text widgets.
1517
1618All seven controls use canvas-based drawing. The library includes its own document parsing, layout, text rendering, Markdown processing, and image decoding capabilities.
1719
1820LazInk supports both small pieces of inline HTML and complete documents containing headings, tables, lists, syntax-highlighted code, images, and CSS styling.
1921
2022A particular feature is `TInkRichEdit`, which allows users to edit formatted Markdown visually instead of editing its source syntax.
2123
2224## Features
2325
2426- Canvas-based text rendering without an embedded browser.
2527- HTML and GitHub Flavored Markdown support.
2628- WYSIWYG Markdown editing.
2729- CSS-styled HTML document rendering.
2830- Syntax-highlighted code blocks.
2931- PNG, animated GIF, and WebP image support.
3032- Text selection, clipboard operations, and keyboard navigation.
3133- Zoom and touch scrolling.
3234- Light and dark color-scheme support.
3335- Interactive links and document navigation.
3436- Cross-platform architecture using the Lazarus LCL.
3537- No third-party runtime dependencies.
3638
3739## Components
3840
3941Installing LazInk adds seven controls to the **LazInk** component palette.
4042
4143| Component | Description |
4244| -------------- | --------------------------------------------------------------------------------------------- |
4345| `TInkLabel` | Displays a caption with inline HTML formatting, links, wrapping, and optional text selection. |
4446| `TInkEdit` | Single-line editor supporting per-character styling, selection, and undo/redo. |
4547| `TInkMemo` | Scrollable formatted text viewer for logs, messages, transcripts, and streaming content. |
4648| `TInkListBox` | List box displaying formatted text with selectable and editable entries. |
4749| `TInkRichEdit` | WYSIWYG rich-text editor supporting Markdown input and output. |
4850| `TInkCodeMemo` | Plain multiline editor with optional character styling and automatic height adjustment. |
4951| `TInkPage` | Complete HTML and Markdown document viewer with CSS, images, links, and navigation. |
5052
5153### TInkLabel
5254
5355`TInkLabel` is an alternative to `TLabel` for applications requiring formatted captions.
5456
5557It supports inline HTML markup, including font styling, foreground and background colors, links, and text decoration.
5658
5759```pascal
5860InkLabel1.Caption :=
5961 'Status: <b><font color="#00AA00">Connected</font></b>';
6062```
6163
6264Additional features include word wrapping, automatic sizing, alignment, ellipsis handling, and optional text selection.
6365
66+[[File:LazInk TInkLabel and TInkEdit.png|thumb|420px|TInkLabel, TInkEdit and TInkCodeMemo]]
67+
6468### TInkMemo
6569
6670`TInkMemo` displays formatted text in a scrollable control.
6771
6872It is useful for application logs, chat interfaces, debugging output, and other situations where formatted entries are added dynamically.
6973
7074```pascal
7175InkMemo1.TextFormat := itfMarkdown;
7276InkMemo1.Append('**12:04** Build finished, `0 errors`');
7377```
7478
7579The `AppendBlock` method can insert complete formatted messages, including lists, tables, and highlighted code.
7680
7781`ReplaceLast` allows applications to update the most recent message as additional content arrives, making the control useful for streaming AI responses.
7882
83+[[File:LazInk TInkMemo.png|thumb|420px|TInkMemo]]
84+
7985### TInkRichEdit
8086
8187`TInkRichEdit` is a WYSIWYG rich-text editor capable of reading and writing Markdown.
8288
8389It supports:
8490
8591- Bold, italic, underline, and other character formatting.
8692- Font colors, sizes, and backgrounds.
8793- Headings and paragraph alignment.
8894- Nested ordered and unordered lists.
8995- Block quotations.
9096- Tables.
9197- Fenced code blocks.
9298- Hyperlinks.
9399- Undo and redo.
94100- Search within the document.
95101
96102Unlike a conventional Markdown source editor, `TInkRichEdit` allows users to work directly with the rendered document.
97103
98104```pascal
99105InkRichEdit1.LoadMarkdown(
100106 '## My Document' + LineEnding +
101107 'This is **bold** and *italic* text.'
102108);
103109```
104110
105111The edited document can be retrieved as Markdown:
106112
107113```pascal
108114Memo1.Lines.Text := InkRichEdit1.AsMarkdown;
109115```
110116
117+[[File:LazInk TInkRichEdit editor.png|thumb|420px|The WYSIWYG Markdown editor, TInkRichEdit]]
118+
111119### TInkPage
112120
113121`TInkPage` is a lightweight document viewer for displaying HTML and Markdown inside Lazarus applications.
114122
115123```pascal
116124InkPage1.LoadFromFile('help/index.html');
117125```
118126
119127The control includes a document tree, CSS processing, layout engine, image decoding, hyperlinks, history navigation, search, text selection, and zoom.
120128
121129Supported content includes headings, tables, nested lists, code blocks, images, and styled document elements.
122130
123131CSS capabilities include selectors, the cascade, box layout, borders, backgrounds, tables, flex and grid layouts, and media queries.
124132
125133Unlike a web browser, `TInkPage` does not execute JavaScript.
126134
127135Applications can modify the document through its DOM-style API and refresh the displayed content.
128136
129137This makes it suitable for embedded help systems, documentation viewers, release notes, and application dashboards.
130138
139+[[File:LazInk Markdown source and preview.png|thumb|420px|Markdown source on the left, the page drawn from it on the right]]
140+
131141### Other controls
132142
133143`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.
134144
135145`TInkCodeMemo` is a plain multiline editor with character styling, word wrapping, undo, and automatic height adjustment.
136146
137147`TInkListBox` provides formatted list entries, text selection, optional alternating backgrounds, and in-place editing.
138148
149+[[File:LazInk TInkListBox.png|thumb|420px|TInkListBox]]
150+
139151## Installation
140152
1411531. Download or clone the [LazInk repository](https://github.com/TonyStone31/LazInk).
1421542. Open Lazarus.
1431553. Select **Package → Open Package File (.lpk)**.
1441564. Open `lazink.lpk` from the downloaded directory.
1451575. Compile the package.
1461586. Select **Use → Install**.
1471597. Rebuild or restart Lazarus as prompted.
148160
149161The components will appear on the **LazInk** tab of the component palette.
150162
151163## Demonstration application
152164
153165The repository includes a demonstration application at:
154166
155167`demo/lazinkdemo.lpi`
156168
157169Open this project in Lazarus to explore the controls and their features.
158170
159171The demonstration is built using the Lazarus form designer and includes a separate tab for each component.
160172
161173## Supported platforms
162174
163175LazInk is designed around the Lazarus LCL and avoids widgetset-specific rendering implementations.
164176
165177The current project documentation reports testing on:
166178
167179| Platform | Environment |
168180| ------------ | ------------------------------ |
169181| Linux x86-64 | GTK3, Lazarus trunk, FPC 3.3.1 |
170182| macOS Intel | Cocoa, Lazarus 4.8, FPC 3.2.4 |
171183
172184The macOS tests were performed using macOS Sequoia 15 in an Intel virtual machine.
173185
186+[[File:LazInk TInkRichEdit on macOS.png|thumb|420px|The editor running on macOS]]
187+
174188Other Lazarus widgetsets are intended to be supported through the shared LCL drawing architecture, but compatibility should not be assumed without testing.
175189
176190The project is currently usable, although APIs may change as development continues.
177191
178192## Documentation
179193
180194Additional technical documentation is available in the project repository:
181195
182196- [README](https://github.com/TonyStone31/LazInk/blob/master/README.md) — project overview, features, and installation.
183197- [Complete guide](https://github.com/TonyStone31/LazInk/blob/master/docs/GUIDE.md) — detailed documentation of controls, events, properties, markup, and examples.
184198- [HTML and CSS support](https://github.com/TonyStone31/LazInk/blob/master/docs/HTML_SUPPORT.md) — supported document elements and styling capabilities.
185199- [Source code](https://github.com/TonyStone31/LazInk) — complete Object Pascal implementation.
186200- [Issue tracker](https://github.com/TonyStone31/LazInk/issues) — bug reports and feature requests.
187201
188202## License
189203
190204LazInk is released under the **BSD Zero Clause License (0BSD)**, a permissive open-source software license.
191205
192206Some bundled reference data and decoder tables have separate attribution requirements documented in the repository's `LICENSES/THIRD-PARTY.md`.
193207
194208Applications incorporating the WebP decoder through `TInkPage` should retain the applicable RFC 6386 notice as described by the project.
195209
196210## See also
197211
198212- [[Lazarus]]
199213- [[Lazarus Packages]]
200214- [[How To Write Lazarus Component]]
201215- [[Projects using Lazarus - Components and Libraries]]
202216
203-Category\:Lazarus
204-Category\:Components
217+Category:Lazarus
218+Category:Components

Back to history