/*global Showdown */

'use strict';

angular.module('memoFilters', [])
  .filter('markdown', function ($sce) {
    // var converter = new Showdown.converter({ extensions: ['github', 'youtube'] });
    var marked = window.marked;
    var hljs = window.hljs;

    marked.setOptions({
      highlight: function (code, lang) {
        return hljs.highlight(lang, code).value;
      }
    });

    return function (input) {
      if (!input) {
        return null;
      }

      // console.log(input);
      // return $sce.trustAsHtml(converter.makeHtml(input));
      return $sce.trustAsHtml(marked(input));
    };
  });

/*global Showdown */

'use strict';

angular.module('memoFilters', [])
  .filter('markdown', function ($sce) {
    // var converter = new Showdown.converter({ extensions: ['github', 'youtube'] });
    var marked = window.marked;
    var hljs = window.hljs;

    marked.setOptions({
      highlight: function (code, lang) {
        if (lang) {
          return hljs.highlight(lang, code).value;
        } else {
          return hljs.highlightAuto(code).value;
        }
      }
    });

    return function (input) {
      if (!input) {
        return null;
      }

      // console.log(input);
      // return $sce.trustAsHtml(converter.makeHtml(input));
      return $sce.trustAsHtml(marked(input));
    };
  });

Fix an issue to show code without language option
Fix an issue to show code without language option
