nuǝɯ pǝɥsᴉꞁod mǝu
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    mrcleanpublic

    Mr Clean 0.0.1

    MrClean

    Build Status

    It's a HTML Sanitizer! It's a genie!

    It's fabulous!

    Install

    npm install mrclean

    Usage in NodeJs

    with default blacklist

    mrclean = require('mrclean');
     
    dirtyHtml = "Hi! <script src='http://www.evilsite.com/bad_script.js'></script>It's a good day!"
    mrclean().clean(dirtyHtml, function(err, cleanHtml) {
      // All Clean!
      console.log(cleanHtml);
    });
     

    with your own blacklist

    mrclean = require('mrclean');
     
    dirtyHtml = "Hi! <script src='http://www.evilsite.com/bad_script.js'></script>It's a good day!"
    mrclean("html body link script").clean(dirtyHtml, function(err, cleanHtml) {
      // All Clean!
      console.log(cleanHtml);
    });
     

    Usage in the Browser

    First add mrclean.js to your html page.

    <script type="text/javascript">
    $(document).ready(function() {
      $('button').click(function() {
        MrClean().clean($('textarea').val(), function(err, cleanText) {
          console.log(cleanText);
        });
      });
    });
     
    </script>
     

    Build Script to browserify node module

    npm install browserify -g
    browserify browser.js -o mrclean.js
    

    Run Tests

    npm test
    

    Contributing

    Contributors are welcome, please create issues and submit pull requests in feature branches!

    See http://scottchacon.com/2011/08/31/github-flow.html

    License

    SEE LICENSE

    Keywords

    none

    install

    npm i mrclean

    Downloadsweekly downloads

    2

    version

    0.1.0

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar