diff --git a/markdown.js b/markdown.js index 08f2248..65c7881 100644 --- a/markdown.js +++ b/markdown.js @@ -18,17 +18,17 @@ angular.module('btford.markdown', ['ngSanitize']). } }; }). - directive('btfMarkdown', function ($sanitize, markdownConverter) { + directive('btfMarkdown', function ($sce, markdownConverter) { return { restrict: 'AE', link: function (scope, element, attrs) { if (attrs.btfMarkdown) { scope.$watch(attrs.btfMarkdown, function (newVal) { - var html = newVal ? $sanitize(markdownConverter.makeHtml(newVal)) : ''; + var html = newVal ? $sce.trustAsHtml(markdownConverter.makeHtml(newVal)) : ''; element.html(html); }); } else { - var html = $sanitize(markdownConverter.makeHtml(element.text())); + var html = $sce.trustAsHtml(markdownConverter.makeHtml(element.html())); element.html(html); } }