htmlwhitelist 0.2.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • --

Html Whitelist #

Introduction #

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

Usage #

import 'package:htmlwhitelist/htmlwhitelist.dart';

main() {
  var contents = '<b>See:</b> <a href="docs.html">the documentation</a>';
  var safe = Whitelist.simpleText.safeCopy(contents);
  print(safe);
}

prints

<b>See:</b> the documentation

If you have a DocumentFragment instead of a String you can use the Cleaner instead:

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 #

0.2.0 #

  • Added documentation
  • Added tests
  • Removed when from forceAttribute
  • Added when to Whitelist.tags, Whitelist.attributes and Whitelist.extraAttributes
  • Several minor improvements

0.1.0 #

  • Initial implementation

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  htmlwhitelist: ^0.2.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:htmlwhitelist/htmlwhitelist.dart';
  
Version Uploaded Documentation Archive
0.5.3 Sep 17, 2018 Go to the documentation of htmlwhitelist 0.5.3 Download htmlwhitelist 0.5.3 archive
0.5.2 Sep 17, 2018 Go to the documentation of htmlwhitelist 0.5.2 Download htmlwhitelist 0.5.2 archive
0.5.1 Jan 23, 2018 Go to the documentation of htmlwhitelist 0.5.1 Download htmlwhitelist 0.5.1 archive
0.5.0 Jan 23, 2018 Go to the documentation of htmlwhitelist 0.5.0 Download htmlwhitelist 0.5.0 archive
0.4.1 Jan 4, 2017 Go to the documentation of htmlwhitelist 0.4.1 Download htmlwhitelist 0.4.1 archive
0.4.0 Jan 4, 2017 Go to the documentation of htmlwhitelist 0.4.0 Download htmlwhitelist 0.4.0 archive
0.3.0 Dec 29, 2016 Go to the documentation of htmlwhitelist 0.3.0 Download htmlwhitelist 0.3.0 archive
0.2.1 Dec 28, 2016 Go to the documentation of htmlwhitelist 0.2.1 Download htmlwhitelist 0.2.1 archive
0.2.0 Dec 28, 2016 Go to the documentation of htmlwhitelist 0.2.0 Download htmlwhitelist 0.2.0 archive
0.1.0 Dec 20, 2016 Go to the documentation of htmlwhitelist 0.1.0 Download htmlwhitelist 0.1.0 archive

All 11 versions...

Awaiting analysis to complete.