renderConsoleMarkdown function

String renderConsoleMarkdown(
  1. String text, {
  2. required bool styled,
})

text with its console markdown rendered: as ANSI styling when styled, else as plain text, the markers removed and any escape code dropped.

Implementation

String renderConsoleMarkdown(String text, {required bool styled}) {
  final rendered = text.toConsole();
  return styled ? rendered : rendered.replaceAll(_sgr, '');
}