New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simple-marked-sanitizer

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-marked-sanitizer - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

24

index.d.ts

@@ -1,7 +0,23 @@

export default class SimpleMarkedSanitizer {
construct(): SimpleMarkedSanitizer;
export as namespace SimpleMarkedSanitizer;
elementWhiteList(list: string[]): SimpleMarkedSanitizer;
attributeWhiteList(list: {[key: string]: string[]}): SimpleMarkedSanitizer;
export = SimpleMarkedSanitizer;
declare class SimpleMarkedSanitizer {
constructor();
elementWhiteList(): Array<string>;
elementWhiteList(v: Array<string>): SimpleMarkedSanitizer;
attributeWhiteList() : { [key: string]: Array<string> }
attributeWhiteList(v: { [key: string]: Array<string> }): SimpleMarkedSanitizer;
debug(): boolean;
debug(v: boolean): SimpleMarkedSanitizer;
getSanitizer(): (str: string) => string;
}
declare namespace SimpleMarkedSanitizer {
const ELEMENT_WHITELIST: string[];
const ATTRIBUTE_WHITELIST: { [key: string]: Array<string> };
}

@@ -210,5 +210,9 @@ (function(root) {

this._attributeWhiteList = ATTRIBUTE_WHITELIST;
this._debug = false;
}
elementWhiteList(v) {
if (!v) {
return this._elementWhiteList;
}
this._elementWhiteList = v;

@@ -219,2 +223,5 @@ return this;

attributeWhiteList(v) {
if (!v) {
return this._attributeWhiteList;
}
this._attributeWhiteList = v;

@@ -224,2 +231,10 @@ return this;

debug(v) {
if (typeof(v) === "undefined") {
return this._debug;
}
this._debug = v;
return this;
}
getSanitizer() {

@@ -230,7 +245,7 @@ return this.sanitize.bind(this);

sanitize(tag) {
if (tag.startsWith("</")) {
return this.sanitizeCloseTag(tag);
} else {
return this.sanitizeOpenTag(tag);
const result = tag.startsWith("</") ? this.sanitizeCloseTag(tag) : this.sanitizeOpenTag(tag);
if (this._debug) {
console.log(`[SimpleMarkedSanitizer] ${tag} -> ${result}`);
}
return result;
}

@@ -237,0 +252,0 @@

2

package.json
{
"name": "simple-marked-sanitizer",
"version": "0.1.0",
"version": "0.2.0",
"description": "Simple sanitizer for marked",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -47,3 +47,3 @@ # simple-marked-sanitizer

"*": [class", "id", "style"] // `*` means these attributes are allowed to all tags.
});
}).debug(true); // If you want to see conversion result in console.log, switch debug flag to true.

@@ -50,0 +50,0 @@ const htmlString = marked(markdownString, {

@@ -6,3 +6,3 @@ const assert = require("chai").assert;

const DEFAULT_SANITIZER = new Sanitizer();
const DEFAULT_SANITIZER = new Sanitizer().debug(true);

@@ -9,0 +9,0 @@ function apply(input, sanitizer) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc