Angularjs Markdown Modules

Install markdown angular-marked and highlight.js

Install modules:

bower install --save  highlightjs
bower install --save  angular-marked

Angularjs:

[js]
var app = angular.module('exampleApp', ['hc.marked']);
app.config(['markedProvider', function (markedProvider) {
  markedProvider.setOptions({
    gfm: true,
    tables: true,
    highlight: function (code, lang) {
      if (lang) {
        return hljs.highlight(lang, code, true).value;
      } else {
        return hljs.highlightAuto(code).value;
      }
    }
  });
}]);

[/js]

Leave a Reply