build static method
Build sections back into markdown.
Implementation
static String build(List<MemorySection> sections) {
final buffer = StringBuffer();
for (final section in sections) {
final prefix = '#' * section.level;
buffer.writeln('$prefix ${section.heading}');
buffer.writeln();
buffer.writeln(section.content);
buffer.writeln();
if (section.children.isNotEmpty) {
buffer.write(build(section.children));
}
}
return buffer.toString().trimRight();
}