applyToDocument method

Document applyToDocument(
  1. Document document, {
  2. bool clearPrevious = true,
})

Apply this ruleset to the given document and return the result.

Implementation

Document applyToDocument(Document document, {bool clearPrevious = true}) {
  return Document(
    document.paragraphs.map(
      (p) => p.match(
        line: (l) {
          return l.copyWith(
            spans: applyToString(l.spannedText, clearPrevious: clearPrevious),
          );
        },
        embed: (e) => e,
      ),
    ),
  );
}