convert method

  1. @override
Delta convert(
  1. String input
)
override

Converts input and returns the result of the conversion.

Implementation

@override
Delta convert(String input) {
  _delta = Delta();
  _activeInlineAttributes.clear();
  _activeBlockAttributes.clear();
  _topLevelNodes.clear();
  _lastTag = null;
  _currentBlockTag = null;
  _isInBlockQuote = false;
  _isInCodeblock = false;
  _justPreviousBlockExit = false;
  _listItemIndent = -1;

  final lines = const LineSplitter().convert(input);
  final mdNodes = markdownDocument.parseLines(lines);

  _topLevelNodes.addAll(mdNodes);

  for (final node in mdNodes) {
    node.accept(this);
  }

  // Ensure the delta ends with a newline.
  _appendLastNewLineIfNeeded();

  return _delta;
}