Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
fstanis committed Jan 14, 2020
1 parent e95fb2e commit 497b781
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/purifier/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ import Mustache from 'mustache';
import {Purifier} from '@ampproject/purifier';

const purifier = new Purifier(document);
Mustache..setUnescapedSanitizer(value =>
purifier.purifyTagsForTripleMustache(value)
);
const _unescapedValue = Mustache.Writer.prototype.unescapedValue;
Mustache.Writer.prototype.unescapedValue = function(token, context) {
const result = _unescapedValue(token, context);
return purifier.purifyTagsForTripleMustache(result);
};
const html = Mustache.render(template, data);

const body = purifier.purifyHtml(html);
for (const child of body.children) {
targetElement.appendChild(child);
Expand Down

0 comments on commit 497b781

Please sign in to comment.