toHtml static method

String toHtml(
  1. String text
)

Convert markdown to html

Implementation

static String toHtml(String text) {
  String html = "";
  text.split(RegExp(r"\n+")).forEach((element) {
    for (var each in components) {
      if (each.exp.hasMatch(element.trim())) {
        if (each is InlineMd) {
          html += "${each.toHtml(element)}\n";
          break;
        } else if (each is BlockMd) {
          html += "${each.toHtml(element)}\n";
          break;
        }
      }
    }
  });
  return html;
}