Mail-merge placeholders
Define the fields your application can resolve, let users insert them in a template, then merge values when preparing the finished document.


using SpiceLogic.HtmlEditor.Abstractions.Entities.MailMerge;
var name = new PlaceholderField("Customer name", "{{CustomerName}}");
editor.MailMerge.PlaceholderFields.Add(name);
await editor.MailMerge.InsertPlaceholderAsync(name);
await editor.MailMerge.MergeAsync(new Dictionary<string, string?>
{
["Customer name"] = "Alex & Morgan"
});
string html = await editor.GetBodyHtmlAsync();Merge keys are exact display names stored in the field's data-sl-field attribute. Values become literal text, including markup characters. Unsupplied fields remain in the template. Use GetFieldsAsync to discover the fields in accepted content.
Keep values literal
Merge values are text, including angle brackets, ampersands and Unicode. The field display name is the lookup key; its insertion token is separate template data. A field without a supplied value remains available for a later merge.