toHtml method

  1. @override
String toHtml()
override

Render to HTML (for emails, web)

Implementation

@override
String toHtml() {
  final styleStr = _buildStyle();
  final tag = _getHtmlTag();
  final attrs = directives;

  // Convert directives map → HTML attributes
  final attrStr = attrs.entries
      .map((e) => e.value.isEmpty ? e.key : '${e.key}="${e.value}"')
      .join(' ');

  return '<$tag $attrStr style="$styleStr">${_escapeHtml(data)}</$tag>';
}