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 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: LazInk

OldNewLine
1+**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.
2+
3+Unlike 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.
4+
5+- **Project:** [LazInk on GitHub](https://github.com/TonyStone31/LazInk)
6+- **Developer:** Tony Stone
7+- **License:** BSD Zero Clause (0BSD)
8+- **Current version:** 1.0.0.0
9+- **Language:** Object Pascal
10+- **Dependencies:** Lazarus Component Library (LCL)
11+
12+## Overview
13+
14+LazInk was developed to provide consistent, formatted text rendering across Lazarus applications without relying on platform-specific rich-text widgets.
15+
16+All seven controls use canvas-based drawing. The library includes its own document parsing, layout, text rendering, Markdown processing, and image decoding capabilities.
17+
18+LazInk supports both small pieces of inline HTML and complete documents containing headings, tables, lists, syntax-highlighted code, images, and CSS styling.
19+
20+A particular feature is `TInkRichEdit`, which allows users to edit formatted Markdown visually instead of editing its source syntax.
21+
22+## Features
23+
24+- Canvas-based text rendering without an embedded browser.
25+- HTML and GitHub Flavored Markdown support.
26+- WYSIWYG Markdown editing.
27+- CSS-styled HTML document rendering.
28+- Syntax-highlighted code blocks.
29+- PNG, animated GIF, and WebP image support.
30+- Text selection, clipboard operations, and keyboard navigation.
31+- Zoom and touch scrolling.
32+- Light and dark color-scheme support.
33+- Interactive links and document navigation.
34+- Cross-platform architecture using the Lazarus LCL.
35+- No third-party runtime dependencies.
36+
37+## Components
38+
39+Installing LazInk adds seven controls to the **LazInk** component palette.
40+
41+| Component | Description |
42+| -------------- | --------------------------------------------------------------------------------------------- |
43+| `TInkLabel` | Displays a caption with inline HTML formatting, links, wrapping, and optional text selection. |
44+| `TInkEdit` | Single-line editor supporting per-character styling, selection, and undo/redo. |
45+| `TInkMemo` | Scrollable formatted text viewer for logs, messages, transcripts, and streaming content. |
46+| `TInkListBox` | List box displaying formatted text with selectable and editable entries. |
47+| `TInkRichEdit` | WYSIWYG rich-text editor supporting Markdown input and output. |
48+| `TInkCodeMemo` | Plain multiline editor with optional character styling and automatic height adjustment. |
49+| `TInkPage` | Complete HTML and Markdown document viewer with CSS, images, links, and navigation. |
50+
51+### TInkLabel
52+
53+`TInkLabel` is an alternative to `TLabel` for applications requiring formatted captions.
54+
55+It supports inline HTML markup, including font styling, foreground and background colors, links, and text decoration.
56+
57+```pascal
58+InkLabel1.Caption :=
59+ 'Status: <b><font color="#00AA00">Connected</font></b>';
60+```
61+
62+Additional features include word wrapping, automatic sizing, alignment, ellipsis handling, and optional text selection.
63+
64+### TInkMemo
65+
66+`TInkMemo` displays formatted text in a scrollable control.
67+
68+It is useful for application logs, chat interfaces, debugging output, and other situations where formatted entries are added dynamically.
69+
70+```pascal
71+InkMemo1.TextFormat := itfMarkdown;
72+InkMemo1.Append('**12:04** Build finished, `0 errors`');
73+```
74+
75+The `AppendBlock` method can insert complete formatted messages, including lists, tables, and highlighted code.
76+
77+`ReplaceLast` allows applications to update the most recent message as additional content arrives, making the control useful for streaming AI responses.
78+
79+### TInkRichEdit
80+
81+`TInkRichEdit` is a WYSIWYG rich-text editor capable of reading and writing Markdown.
82+
83+It supports:
84+
85+- Bold, italic, underline, and other character formatting.
86+- Font colors, sizes, and backgrounds.
87+- Headings and paragraph alignment.
88+- Nested ordered and unordered lists.
89+- Block quotations.
90+- Tables.
91+- Fenced code blocks.
92+- Hyperlinks.
93+- Undo and redo.
94+- Search within the document.
95+
96+Unlike a conventional Markdown source editor, `TInkRichEdit` allows users to work directly with the rendered document.
97+
98+```pascal
99+InkRichEdit1.LoadMarkdown(
100+ '## My Document' + LineEnding +
101+ 'This is **bold** and *italic* text.'
102+);
103+```
104+
105+The edited document can be retrieved as Markdown:
106+
107+```pascal
108+Memo1.Lines.Text := InkRichEdit1.AsMarkdown;
109+```
110+
111+### TInkPage
112+
113+`TInkPage` is a lightweight document viewer for displaying HTML and Markdown inside Lazarus applications.
114+
115+```pascal
116+InkPage1.LoadFromFile('help/index.html');
117+```
118+
119+The control includes a document tree, CSS processing, layout engine, image decoding, hyperlinks, history navigation, search, text selection, and zoom.
120+
121+Supported content includes headings, tables, nested lists, code blocks, images, and styled document elements.
122+
123+CSS capabilities include selectors, the cascade, box layout, borders, backgrounds, tables, flex and grid layouts, and media queries.
124+
125+Unlike a web browser, `TInkPage` does not execute JavaScript.
126+
127+Applications can modify the document through its DOM-style API and refresh the displayed content.
128+
129+This makes it suitable for embedded help systems, documentation viewers, release notes, and application dashboards.
130+
131+### Other controls
132+
133+`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.
134+
135+`TInkCodeMemo` is a plain multiline editor with character styling, word wrapping, undo, and automatic height adjustment.
136+
137+`TInkListBox` provides formatted list entries, text selection, optional alternating backgrounds, and in-place editing.
138+
139+## Installation
140+
141+1. Download or clone the [LazInk repository](https://github.com/TonyStone31/LazInk).
142+2. Open Lazarus.
143+3. Select **Package → Open Package File (.lpk)**.
144+4. Open `lazink.lpk` from the downloaded directory.
145+5. Compile the package.
146+6. Select **Use → Install**.
147+7. Rebuild or restart Lazarus as prompted.
148+
149+The components will appear on the **LazInk** tab of the component palette.
150+
151+## Demonstration application
152+
153+The repository includes a demonstration application at:
154+
155+`demo/lazinkdemo.lpi`
156+
157+Open this project in Lazarus to explore the controls and their features.
158+
159+The demonstration is built using the Lazarus form designer and includes a separate tab for each component.
160+
161+## Supported platforms
162+
163+LazInk is designed around the Lazarus LCL and avoids widgetset-specific rendering implementations.
164+
165+The current project documentation reports testing on:
166+
167+| Platform | Environment |
168+| ------------ | ------------------------------ |
169+| Linux x86-64 | GTK3, Lazarus trunk, FPC 3.3.1 |
170+| macOS Intel | Cocoa, Lazarus 4.8, FPC 3.2.4 |
171+
172+The macOS tests were performed using macOS Sequoia 15 in an Intel virtual machine.
173+
174+Other Lazarus widgetsets are intended to be supported through the shared LCL drawing architecture, but compatibility should not be assumed without testing.
175+
176+The project is currently usable, although APIs may change as development continues.
177+
178+## Documentation
179+
180+Additional technical documentation is available in the project repository:
181+
182+- [README](https://github.com/TonyStone31/LazInk/blob/master/README.md) — project overview, features, and installation.
183+- [Complete guide](https://github.com/TonyStone31/LazInk/blob/master/docs/GUIDE.md) — detailed documentation of controls, events, properties, markup, and examples.
184+- [HTML and CSS support](https://github.com/TonyStone31/LazInk/blob/master/docs/HTML_SUPPORT.md) — supported document elements and styling capabilities.
185+- [Source code](https://github.com/TonyStone31/LazInk) — complete Object Pascal implementation.
186+- [Issue tracker](https://github.com/TonyStone31/LazInk/issues) — bug reports and feature requests.
187+
188+## License
189+
190+LazInk is released under the **BSD Zero Clause License (0BSD)**, a permissive open-source software license.
191+
192+Some bundled reference data and decoder tables have separate attribution requirements documented in the repository's `LICENSES/THIRD-PARTY.md`.
193+
194+Applications incorporating the WebP decoder through `TInkPage` should retain the applicable RFC 6386 notice as described by the project.
195+
196+## See also
197+
198+- [[Lazarus]]
199+- [[Lazarus Packages]]
200+- [[How To Write Lazarus Component]]
201+- [[Projects using Lazarus - Components and Libraries]]
202+
203+Category\:Lazarus
204+Category\:Components

Back to history