/** * An element which displays its content processed as markdown. */ angular.module('quay').directive('markdownView', function () { var directiveDefinitionObject = { priority: 0, templateUrl: '/static/directives/markdown-view.html', replace: false, transclude: false, restrict: 'C', scope: { 'content': '=content', 'firstLineOnly': '=firstLineOnly', 'placeholderNeeded': '=placeholderNeeded' }, controller: function($scope, $element, $sce, UtilService) { $scope.getMarkedDown = function(content, firstLineOnly) { if (firstLineOnly) { return $sce.trustAsHtml(UtilService.getFirstMarkdownLineAsText(content, $scope.placeholderNeeded)); } return $sce.trustAsHtml(UtilService.getMarkedDown(content)); }; } }; return directiveDefinitionObject; });