A Delphi library for converting BBCode to Rich Text Format (RTF).
Explore the code »
View Demo
·
Report Bug
·
Request Feature
BBCode4D is a Delphi library that allows you to easily convert BBCode markup to RTF, which can be displayed in a TRichEdit
component. This is ideal for applications where users need to format text with basic formatting options like bold, italics, lists, and links.
Currently, the library supports converting BBCode to RTF. The reverse functionality (RTF to BBCode) is planned for future development.
- Delphi (tested with Delphi 12)
There are two ways to install BBCode4D:
-
Include the
BBCode4D.pas
file: Simply add theBBCode4D.pas
file to your project and include it in your uses clause. -
Use Boss: If you're using the Boss package manager for Delphi, you can install BBCode4D by running the following command:
boss install weslleycapelari/BBCode4D
To use BBCode4D, follow these steps:
-
Parse the BBCode: Use the
TBBCode4D.ParseBBCode
function to parse the BBCode string. This will return aTBBCode4D
object. -
Write to RichEdit: Call the
WriteToRich
method of theTBBCode4D
object, passing theTRichEdit
component where you want to display the formatted text.
var
LBBCode: string;
LBBCodeParser: TBBCode4D;
begin
LBBCode := '[b]This is bold text[/b]';
LBBCodeParser := TBBCode4D.ParseBBCode(LBBCode);
LBBCodeParser.WriteToRich(RichEdit);
end;
- Implement RTF to BBCode conversion.
- Add support for more BBCode tags.
- Improve error handling and reporting.
Contributions are welcome! Please see the CONTRIBUTING.md file for guidelines.
BBCode4D is distributed under the MIT License. See the LICENSE.txt file for more information.
Weslley Capelari - [email protected]
Thanks to the Delphi community for their support and feedback.