createNode method

Node createNode(
  1. String destination,
  2. String? title, {
  3. required List<Node> getChildren(),
})

Create the node represented by a Markdown link.

Implementation

Node createNode(
  String destination,
  String? title, {
  required List<Node> Function() getChildren,
}) {
  final children = getChildren();
  final element = Element('a', children);
  element.attributes['href'] = normalizeLinkDestination(
    escapePunctuation(destination),
  );
  if (title != null && title.isNotEmpty) {
    element.attributes['title'] = normalizeLinkTitle(
      escapePunctuation(title),
    );
  }
  return element;
}