Html Whitelist

Introduction

This library can be used to whitelist html elements, attributes and attribute values.

Usage

import 'package:htmlwhitelist/htmlwhitelist.dart';
import 'package:html/parser.dart';
import 'package:html/dom.dart';

main() {
  var contents = '<b>See:</b> <a href="docs.html">the documentation</a>';

  DocumentFragment fragment = parseFragment(contents);
  DocumentFragment safeCopy = Whitelist.simpleText.cleaner().safeCopy(fragment);

  print(safeCopy.outerHtml);
}

prints

<b>See:</b> the documentation

License and contributors

Libraries

htmlwhitelist