convertHtmlToMarkdown function

String convertHtmlToMarkdown(
  1. String htmlText,
  2. List<Rule>? rules,
  3. List<String> ignoreRules, {
  4. bool removeLeadingWhitespaces = false,
  5. bool escape = true,
})

Implementation

String convertHtmlToMarkdown(
    String htmlText, List<hm2.Rule>? rules, List<String> ignoreRules,
    {bool removeLeadingWhitespaces = false, bool escape = true}) {
  if (!ignoreRules.contains('underline')) ignoreRules.add('underline');
  return hm2.convert(
    styleOptions: <String, String>{'emDelimiter': '*'},
    htmlText,
    escape: escape,
    rules: rules,
    removeLeadingWhitespaces: removeLeadingWhitespaces,
    ignore: ignoreRules,
  );
}