Home

Awesome

Emmet engine for Delphi and Free Pascal

Emmet is mostly used by web-developers to simplify and speed up editing. Emmet can take an abbreviation and expand it into a structured code block. Standard Emmet is written in JavaScript and available in many text editors or web development tools. This is Emmet for Delphi and Free Pascal. It is written from scratch and is used in RJ TextEd and CudaText applications.

Getting Started

Download the files and include the Pascal files in your project.

Usage

First you need to create an Emmet object.

FEmmet := TEmmet.Create(snippetsPath, loremPath);

To expand an abbreviation, use

sExpanded := FEmmet.ExpandAbbreviation(sAbbr, sSyntax, sSelText, sSection, bMultiCursorTabs);

Parameters:

Result: sExpanded is the resulting expanded code. It may contain cursor | positions or selected tab ${1:charset} positions.

Using the overloaded version you can set some options.

var rOptions: TExpandOptions;
rOptions.Wordwrap := True;
rOptions.AddSlashToEmptyTags := False;
sExpanded := FEmmet.ExpandAbbreviation(sAbbr, sSyntax, sSelText, sSection, bMultiCursorTabs, rOptions);

Wrap with abbreviation

To use this feature, use parameter sSelText. E.g. if you call ExpandAbbreviation() with:

Line 1
Line 2
Line 3
Line 4

You get the result

<ul>
  <li>Line 1</li>
  <li>Line 2</li>
  <li>Line 3</li>
  <li>Line 4</li>
</ul>

Cheat sheets

Authors