VisionistInc / showdown-xss-filter

XSS filter for the Showdown markdown converter

Home Page:http://visionistinc.github.io/showdown-xss-filter/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

showdown-xss-filter

Showdown extension to filter XSS, using leizongmin/js-xss.

npm version

Client-side

<script src="/path/to/showdown/src/showdown.js"></script>
<script src="/path/to/xss/dist/xss.min.js"></script>
<script src="/path/to/showdown-xss-filter.js"></script>
var converter = new showdown.Converter({ extensions: ['xssfilter'] })
var text = "<script>alert('xss!')</script>";
console.log(converter.makeHtml(text));

Note: be sure to include the dependency on leizongmin/js-xss before this extension.

Server-side (node)

var showdown = require('showdown');
var xssFilter = require('showdown-xss-filter');
var converter = new showdown.Converter({extensions: [xssFilter]});

var text = "<script>alert('xss!')</script>";
console.log(converter.makeHtml(text));

About

XSS filter for the Showdown markdown converter

http://visionistinc.github.io/showdown-xss-filter/

License:MIT License


Languages

Language:JavaScript 100.0%