Page MenuHomeSealhub

html.js
No OneTemporary

"use strict";
const sanitizeHtml = require("sanitize-html");
module.exports = {
name: "html",
extends: "text",
encode: function(context, params, value){
return {
original: value,
safe: sanitizeHtml(value, {
allowedTags: sanitizeHtml.defaults.allowedTags.concat([ "img", "h1", "h2" ])
}),
};
},
format: function(context, params, decoded_value, format){
let ret;
if(decoded_value===undefined) return undefined;
switch(format){
case "unsafe":
ret = decoded_value.original;
break;
case "original":
ret = decoded_value.original;
break;
default:
ret = decoded_value.safe;
break;
}
return ret;
}
};

File Metadata

Mime Type
text/plain
Expires
Sat, Sep 20, 22:48 (22 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
943035
Default Alt Text
html.js (659 B)

Event Timeline