diff --git a/src/js/index.js b/src/js/index.js index 016a19956..202c78e1d 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -394,8 +394,13 @@ app.filter('markdown2html', function () { tables: true }); + // without this cache, the code runs into some infinite loop (https://github.com/angular/angular.js/issues/3980) + var cache = {}; + return function (text) { - return converter.makeHtml(text); + if (cache[text]) return cache[text]; + cache[text] = converter.makeHtml(text); + return cache[text]; }; });