toMarkdown method

String toMarkdown({
  1. String prefix = '',
})

## Matches and ## Related Context with citations of the form prefix + source-path:lines, then the notices. prefix is how the reader reaches the bundle, such as knowledge/. Control characters are escaped.

Implementation

String toMarkdown({String prefix = ''}) {
  MarkdownPassage passage(KnowledgeCitation citation) => (
    prefix: prefix,
    bundle: null,
    bundleRoot: bundle.root,
    chunk: citation.chunk,
    reason: citation.reason,
    relationship: citation.relationship,
    viaPath: citation.viaPath,
    sourceChanged: citation.sourceChanged,
  );
  return renderSearchMarkdown(
    matches: [for (final match in matches) passage(match)],
    context: [for (final entry in context) passage(entry)],
    notices: [for (final notice in notices) notice.text],
  );
}